My agentic slop goes here. Not intended for anyone else!
1(* Test River library with logging enabled *)
2
3let setup_logging () =
4 (* Configure logging - set to Debug level to see all logs *)
5 Logs.set_reporter (Logs_fmt.reporter ());
6 Logs.set_level (Some Logs.Debug);
7
8 (* You can also configure specific sources *)
9 (* For example, to only see info and above for HTTP: *)
10 (* Logs.Src.set_level (Logs.Src.find "river.http") (Some Logs.Info); *)
11
12 Printf.printf "Logging configured at Debug level\n";
13 Printf.printf "Log sources:\n";
14 Printf.printf " - river: Main aggregator\n";
15 Printf.printf " - river.http: HTTP client operations\n";
16 Printf.printf " - river.feed: Feed parsing\n";
17 Printf.printf " - river.post: Post processing\n";
18 Printf.printf "---\n\n"
19
20let test_sources =
21 River.
22 [
23 { name = "Test Feed"; url = "https://example.com/feed.xml" };
24 ]
25
26let main env =
27 (* Test with logging *)
28 Printf.printf "Testing River library with logging...\n\n";
29
30 (* Use River.with_session for proper resource management *)
31 River.with_session env @@ fun session ->
32 (* Demonstrate fetching with logging *)
33 let feeds =
34 try
35 List.map (River.fetch session) test_sources
36 with
37 | Failure msg ->
38 Printf.printf "Expected error (for demo): %s\n" msg;
39 []
40 | e ->
41 Printf.printf "Error: %s\n" (Printexc.to_string e);
42 []
43 in
44
45 if feeds <> [] then begin
46 (* This would show post aggregation logs *)
47 let posts = River.posts feeds in
48 Printf.printf "\nFound %d posts\n" (List.length posts);
49
50 (* This would show Atom entry creation logs *)
51 let _entries = River.create_atom_entries posts in
52 Printf.printf "Created Atom entries\n"
53 end
54
55let () =
56 setup_logging ();
57
58 Printf.printf "Starting River with integrated logging...\n\n";
59
60 Eio_main.run @@ fun env ->
61 main env;
62
63 Printf.printf "\nRiver library successfully integrated with Logs!\n";
64 Printf.printf "\nLog levels used:\n";
65 Printf.printf " - Debug: Detailed parsing and processing info\n";
66 Printf.printf " - Info: High-level operations (fetching, aggregating)\n";
67 Printf.printf " - Warning: Recoverable issues\n";
68 Printf.printf " - Error: Failures and exceptions\n"