My agentic slop goes here. Not intended for anyone else!
1(* Clean logging example for River library *)
2
3let setup_logging level =
4 Logs.set_reporter (Logs_fmt.reporter ());
5 Logs.set_level level
6
7let () =
8 (* Set up Info level logging for cleaner output *)
9 setup_logging (Some Logs.Info);
10
11 Printf.printf "=== River Library with Integrated Logging ===\n\n";
12 Printf.printf "The River library now includes comprehensive logging:\n\n";
13
14 Printf.printf "Log Sources:\n";
15 Printf.printf " • river - Main aggregator operations\n";
16 Printf.printf " • river.http - HTTP client and requests\n";
17 Printf.printf " • river.feed - Feed parsing (Atom/RSS)\n";
18 Printf.printf " • river.post - Post processing and aggregation\n\n";
19
20 Printf.printf "Log Levels:\n";
21 Printf.printf " • Debug - Detailed parsing, HTTP session creation, post counts\n";
22 Printf.printf " • Info - Feed fetching, aggregation operations\n";
23 Printf.printf " • Warn - Recoverable issues (not used currently)\n";
24 Printf.printf " • Error - Connection failures, parsing errors, timeouts\n\n";
25
26 Printf.printf "Example Usage:\n";
27 Printf.printf " (* Set up logging *)\n";
28 Printf.printf " Logs.set_reporter (Logs_fmt.reporter ());\n";
29 Printf.printf " Logs.set_level (Some Logs.Info);\n\n";
30
31 Printf.printf " (* Use River normally - logs will be emitted automatically *)\n";
32 Printf.printf " Eio_main.run @@ fun env ->\n";
33 Printf.printf " let feed = River.fetch env source in\n";
34 Printf.printf " let posts = River.posts [feed] in\n";
35 Printf.printf " ...\n\n";
36
37 Printf.printf "Integration with Requests:\n";
38 Printf.printf " River's HTTP module uses the Requests library, which has its own\n";
39 Printf.printf " logging under the 'requests.*' namespace. Both libraries use the\n";
40 Printf.printf " same Logs infrastructure for consistent logging.\n\n";
41
42 Printf.printf "Benefits:\n";
43 Printf.printf " ✓ Debugging feed parsing issues\n";
44 Printf.printf " ✓ Monitoring HTTP performance\n";
45 Printf.printf " ✓ Tracking post aggregation\n";
46 Printf.printf " ✓ Consistent with Requests library\n"