ReviewOS

also looking at this

craft-native/craft

feat(log): --log-file, and a logger that survives being used

#78
Merged chris wants to merge feat/log-file into main
5 files +691 -37
packages/zig/build.zigmodified+15-0
Changes to packages/zig/build.zig
@@ -744,6 +744,19 @@ pub fn build(b: *std.Build) void {
744744 });
745745 bridge_shell_tests.root_module.link_libc = true;
746746
747 // The host logger's own internals. `test/log_test.zig` already exercises it
748 // through the module boundary, which cannot reach the config storage or the
749 // formatter — the three places it was wrong. Rooted at the source file so
750 // those are reachable.
751 const log_unit_tests = b.addTest(.{
752 .root_module = b.createModule(.{
753 .root_source_file = b.path("src/log.zig"),
754 .target = target,
755 .optimize = optimize,
756 }),
757 });
758 log_unit_tests.root_module.link_libc = true;
759
747760 // The conformance test: what craft declares, against what it dispatches.
748761 const capability_conformance_tests = b.addTest(.{
749762 .root_module = b.createModule(.{
@@ -1115,6 +1128,7 @@ pub fn build(b: *std.Build) void {
11151128 const run_local_tls_tests = b.addRunArtifact(local_tls_tests);
11161129 const run_menu_roles_tests = b.addRunArtifact(menu_roles_tests);
11171130 const run_capabilities_tests = b.addRunArtifact(capabilities_tests);
1131 const run_log_unit_tests = b.addRunArtifact(log_unit_tests);
11181132 const run_bridge_shell_tests = b.addRunArtifact(bridge_shell_tests);
11191133 const run_window_lifecycle_tests = b.addRunArtifact(window_lifecycle_tests);
11201134 const run_window_registry_tests = b.addRunArtifact(window_registry_tests);
@@ -1237,6 +1251,7 @@ pub fn build(b: *std.Build) void {
12371251 test_step.dependOn(&run_local_tls_tests.step);
12381252 test_step.dependOn(&run_menu_roles_tests.step);
12391253 test_step.dependOn(&run_capabilities_tests.step);
1254 test_step.dependOn(&run_log_unit_tests.step);
12401255 test_step.dependOn(&run_bridge_shell_tests.step);
12411256 test_step.dependOn(&run_window_lifecycle_tests.step);
12421257 test_step.dependOn(&run_window_registry_tests.step);