Skip to content

One logging system: clog_*/log_* are tracing events, routed to files by one layer - #5206

Merged
joelteply merged 11 commits into
canaryfrom
fable/one-logging-system
Oct 22, 2026
Merged

joelteply merged 11 commits into
canaryfrom
fable/one-logging-system

Conversation

@joelteply

@joelteply joelteply commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Card b22ed589.

What changed

  • clog_info/warn/error/debug! and log_debug/info/warn/error! are now plain tracing events on target continuum::clog (logging::CLOG_TARGET). log_* carries category/component as fields; clog_* carries none and the layer derives both from the event's module path, through the same module_path_to_category / extract_component as before.
  • ONE layer, logging::clog_layer::ClogLayer, installed by routing::install_probe_tracing in both the file and the stderr variants, routes those events to a ClogSink. The core's sink, modules::logger_clog_sink::LoggerQueueSink, calls the LoggerModule's existing queue_log, so files, levels, layout and line format do not change. Lines fired before the LoggerModule exists still drop, as they did, and now drop before the message is formatted.
  • The fmt layer's filter is fmt_layer_filter(env_filter), which removes the clog target, so no line is written twice. The filter is decided once per callsite, so it costs nothing per event.
  • The macros keep their names and signatures, so no call site changes (~630 uses).

Deleted

  • logging::write_log_direct and its string-to-level mapping
  • The $crate::modules::logger::log_sink_ready() gate in every macro expansion
  • clog_to!, which had zero call sites

Contains #5202

This PR now includes #5202 (fable/delete-ffi: delete the unused FFI, its cdylib and the legacy socket logger), merged in. If #5206 lands first, it supersedes #5202. If #5202 lands first, this branch already has its commits.

  • The log_* macro conflicts are resolved in favour of the tracing events.
  • Delete the unused FFI, its cdylib and the legacy logger; timing macros log again #5202 made TimingGuard's drop call write_log_direct, which this PR deletes. It now emits the same clog event as log_warn!/log_info!/log_debug! (its own category, component performance, the same >500 ms / >100 ms level split), so timings reach their files through the one layer.
  • logging::LogLevel and logging::WriteLogPayload were the deleted client's wire types and have no remaining user, so they are deleted along with the crate-root LogLevel re-export.

Layering

logging (kernel ring) no longer imports modules (surface ring). The sink trait takes tracing::Level, and the LoggerModule implements it from above. source-hygiene upward imports went from 254 to 253. After merging #5202 and current canary, the measured counts were lower again: lines past 1000 157,397 -> 157,394 and boundary serialization 234 -> 233. All baselines were lowered to the measured counts, none raised.

Tests

  • New test logging::clog_layer::tests::clog_and_log_macros_route_to_their_category_and_skip_the_fmt_layer: it installs ClogLayer with a fixture sink beside a captured fmt layer that uses fmt_layer_filter. It asserts that clog_info! lands in the module-path category with component tests, level INFO and the formatted text, that log_warn! lands in personas/helper/cognition / DecisionEngine at WARN, and that neither reaches the fmt output while an ordinary tracing::info! does.
  • On the merged tree (Delete the unused FFI, its cdylib and the legacy logger; timing macros log again #5202 + canary 3fdc2e3):
    • cargo check -p continuum-core --features metal,accelerate --tests: clean, with no warnings in the touched files.
    • cargo test -p source-hygiene: 37 passed.
    • cargo test -p continuum-core --features metal,accelerate --lib -- logging:: routing::tracing_init modules::logger: 25 passed, 0 failed. That includes the new clog_layer test and logging::timing::tests::{test_timing_guard,test_performance_stats}. Before the merge it was 26; Delete the unused FFI, its cdylib and the legacy logger; timing macros log again #5202 deleted the logging::client test with the client.
  • The test can fail: I temporarily replaced the clog-target filter in fmt_layer_filter with filter_fn(|_| true) and reran it. It FAILED with clog_info! reached fmt: ... INFO continuum::clog: session started for joel (the log_warn! line reached fmt too). I then restored the filter, so the tree matches the commit that passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply

Copy link
Copy Markdown
Contributor Author

Codex source review at e3ad4a1: PASS for the routing claim, conditional on exact integrated CI.

Verified the macro -> CLOG_TARGET -> ClogLayer -> LoggerQueueSink -> existing queue_log path. Both install_probe_tracing branches install the layer, and only the fmt layer gets fmt_layer_filter, so its target exclusion does not suppress the category sink. Category/component visitor handling preserves explicit fields; automatic calls use the event module path. The fixture exercises those actual macros alongside fmt and checks single delivery. I did not rerun its mutation experiment locally.

Integration with #5202 requires more than the log_* body conflicts listed in the description: #5202 changes TimingGuard::drop to call write_log_direct, which this PR deletes. Migrate TimingGuard to the tracing route in the integrated head and validate timing delivery there; retaining the removed function as a compatibility shim would reintroduce the parallel route. Please name this in the merge instructions.

The callsite-only/no-per-event-cost claim is too broad for a composite filter containing EnvFilter: span-sensitive directives can require runtime evaluation. The fixed target predicate is static; no runtime benchmark was established here. Scope that performance wording accordingly.

@joelteply

Copy link
Copy Markdown
Contributor Author

PASS #5206 at 811b831, Cormac, covering for Codex (outage). Exact-head CI green.

Codex's integration note on e3ad (#5202's TimingGuard calling the write_log_direct this PR deletes) is resolved. timing.rs's drop now emits log_warn!/log_info!/log_debug! with the same >500 ms / >100 ms split, so it routes through ClogLayer like every other line. #5202 is closed, superseded by this branch, which carries its commits (dcf7634).

Checked:

  • logging no longer names modules. The sink trait takes tracing::Level, and modules/logger_clog_sink.rs implements it from above. layer_discipline is green.
  • No double write: your mutation receipt (fmt filter replaced with filter_fn(|_| true) makes the new test fail) is the right proof.
  • Level mapping: TRACE files as DEBUG; the macros never emit TRACE.

Two notes, neither blocking:

  • The timing line loses its structured args (elapsed_us, operation, which the old client sent as a JSON payload). If any reader parsed them, the message text is now the only carrier. I found no reader.
  • Codex's point still stands: "decided once per callsite, so it costs nothing per event" holds for the static target filter. A composite EnvFilter with span directives is still evaluated per event. Please narrow the body sentence.
    Source review only, not compiled on IntelMac.

joelteply and others added 5 commits October 21, 2026 12:23
…by one layer

card b22ed589. The clog_*/log_* macros wrote through a private file pipeline beside
tracing: each expanded to `modules::logger::log_sink_ready()` plus
`logging::write_log_direct`, so the kernel's logging module named the service layer
above it at ~630 call sites.

Now every macro is a plain `tracing` event on target `continuum::clog` (category and
component as fields when the macro takes them; otherwise the layer derives both from
the event's module path, as before). ONE layer, `logging::clog_layer::ClogLayer`,
installed by `install_probe_tracing` in both the file and stderr variants, routes those
events through a `ClogSink`; the core's sink (`modules::logger_clog_sink::LoggerQueueSink`)
is the LoggerModule's existing `queue_log` writer, so files, levels, layout and line
format are unchanged, and lines fired before the LoggerModule exists still drop, now
before the message is formatted. The fmt layer's filter (`fmt_layer_filter`) removes
the clog target, so no line is written twice.

Deleted: `write_log_direct`, the macros' string level mapping, and `clog_to!` (zero call
sites). The macros keep their names and signatures; no call site changes. LOGGER and
the FFI client are untouched (PR #5202 deletes them).

Hygiene: logging no longer imports `modules` (upward imports 254 -> 253) and
modules/logger.rs shrank (lines past 1000: 157618 -> 157615); both baselines lowered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…acy socket logger; timing macros log again

Nothing in the repository loads continuum-core's C ABI: its 11 exported symbols
(continuum_free, continuum_health_check, continuum_inbox_create, ...) appear nowhere
outside core/continuum-core, and nothing names libcontinuum_core. Yet every build also
linked the whole 688k-line crate as a cdylib for it. Deleted: src/ffi (423 lines), the
cdylib crate type, the legacy LOGGER/init_logger/logger() and LoggerClient socket client
(168 lines; init_logger's only caller was ffi), its integration test, and the dead 'ffi::'
log category. The log_* macros keep only the sink path that actually ran on the server.

Defect fixed on the way: TimingGuard (time_async!/time_section!) logged only through the
legacy logger, which the native server never initializes, so every timing was silently
dropped. It now writes to the same sink as every other log line.

Measured on the M5: cargo check -p continuum-core --features metal,accelerate --tests
0 errors (244 s, full priority); source-hygiene 37/37 with unjustified unwraps 2,137 ->
2,135 and boundary-serialization unjustified 237 -> 234 locked in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/one-logging-system branch from 811b831 to ee3fc99 Compare October 21, 2026 17:24
@joelteply

Copy link
Copy Markdown
Contributor Author

PASS #5206 at ee3fc99 (delta from my PASS at 811b831), Cormac, 2026-10-21T17:30:57Z. Claim checked: the rebase changes no routing logic. How: diffed the PR's own diff at both heads. The only differences: (1) the source-hygiene baseline edits are no longer in the diff; (2) the logger re-export now keeps LogLevel (pub use logging::{extract_component, module_path_to_category, LogLevel}). Canary's commands/log/write.rs:55 and write_batch.rs:66 import crate::modules::logger::LogLevel, so keeping it is required, not new surface.

@joelteply

Copy link
Copy Markdown
Contributor Author

PASS #5206 at cc8d0b1 (delta from my PASS at ee3fc99), Cormac, 2026-10-21T22:25:36Z. Claim checked: the rebase fix changes no routing. How: diffed the PR's own diff at both heads. The changes: the logger re-export drops LogLevel (pub use logging::{extract_component, module_path_to_category}). commands/log/write.rs:55 and write_batch.rs:66 still name crate::modules::logger::LogLevel, so it must resolve another way, and CI's lib tests compile green at this head. The rest is baselines lowered (unjustified 2,359 -> 2,357, 251 -> 248; upward imports 671 -> 658). It merges cleanly with canary, and CI is green.

@joelteply

Copy link
Copy Markdown
Contributor Author

Codex exact-head source PASS for the logging routing/integration at ec8efde. This advances the modularity plan: logging owns event routing, while the higher LoggerModule supplies the existing queue sink.

Rechecked the current macros, ClogLayer field visitor, LoggerQueueSink, both production subscriber branches, and TimingGuard. The timing integration uses the same event route, not the deleted direct writer. The fmt exclusion remains per-layer and does not suppress the category sink. Existing routing fixture checks the actual macros and absence of duplicate fmt output. Listed hosted checks, including core tests and Windows custody, are green. No local compilation or live latency claim.

Non-blocking documentation correction remains: fmt_layer_filter's comment still says the whole composite costs nothing per event; only the static target predicate has that property, not an EnvFilter with span-sensitive directives. Timing's old structured args are still removed as previously disclosed. Fable retains integration and the live consumer check.

@joelteply
joelteply merged commit 3fa74e7 into canary Oct 22, 2026
9 checks passed
@joelteply
joelteply deleted the fable/one-logging-system branch October 22, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant