(* Test River library with logging enabled *) let setup_logging () = (* Configure logging - set to Debug level to see all logs *) Logs.set_reporter (Logs_fmt.reporter ()); Logs.set_level (Some Logs.Debug); (* You can also configure specific sources *) (* For example, to only see info and above for HTTP: *) (* Logs.Src.set_level (Logs.Src.find "river.http") (Some Logs.Info); *) Printf.printf "Logging configured at Debug level\n"; Printf.printf "Log sources:\n"; Printf.printf " - river: Main aggregator\n"; Printf.printf " - river.http: HTTP client operations\n"; Printf.printf " - river.feed: Feed parsing\n"; Printf.printf " - river.post: Post processing\n"; Printf.printf "---\n\n" let test_sources = River. [ { name = "Test Feed"; url = "https://example.com/feed.xml" }; ] let main env = (* Test with logging *) Printf.printf "Testing River library with logging...\n\n"; (* Use River.with_session for proper resource management *) River.with_session env @@ fun session -> (* Demonstrate fetching with logging *) let feeds = try List.map (River.fetch session) test_sources with | Failure msg -> Printf.printf "Expected error (for demo): %s\n" msg; [] | e -> Printf.printf "Error: %s\n" (Printexc.to_string e); [] in if feeds <> [] then begin (* This would show post aggregation logs *) let posts = River.posts feeds in Printf.printf "\nFound %d posts\n" (List.length posts); (* This would show Atom entry creation logs *) let _entries = River.create_atom_entries posts in Printf.printf "Created Atom entries\n" end let () = setup_logging (); Printf.printf "Starting River with integrated logging...\n\n"; Eio_main.run @@ fun env -> main env; Printf.printf "\nRiver library successfully integrated with Logs!\n"; Printf.printf "\nLog levels used:\n"; Printf.printf " - Debug: Detailed parsing and processing info\n"; Printf.printf " - Info: High-level operations (fetching, aggregating)\n"; Printf.printf " - Warning: Recoverable issues\n"; Printf.printf " - Error: Failures and exceptions\n"