feat: adopt dig-logging for real retrievable node logs (#553)#47
Merged
Conversation
The node engine (dig_node_core) and its P2P/TLS stack emit tracing events, but dig-node-service installed NO subscriber, so every event was silently dropped and a Windows-service run produced no log at all. Adopt the shared dig-logging crate: a rolling daily JSONL file (per-OS machine log dir) plus human stderr, behind one reloadable level filter. - Install the subscriber at the SERVE entrypoints only (block_on_serve for the foreground/unix daemon, win_service::run_service for the Windows service); one-shot CLI commands do not. The guard lives in a process-global OnceLock so control.log.setLevel can reach the reload handle. Run context (machine vs dev-fallback dir) mirrors the #501 daemon/CLI split. - Migrate every serve-path eprintln! to tracing at the level matching its MEANING (error/warn/info/debug) with structured fields, not string concat. - Add control.log.setLevel (live level reload) + mount the shared `logs` path|tail|level|bundle verbs; `logs level <filter>` persists AND live-applies to a running node. - Route per-request logging through logging::log_rpc_dispatch, which takes only the method name so request params (carrying tokens) can never be logged; tests/never_log.rs locks in the never-log-at-source guarantee (SPEC §7). - Document the logging surface in SPEC.md §20 + §7.4; bump to 0.38.0 (minor). Co-Authored-By: Claude <noreply@anthropic.com>
MichaelTaylor3d
force-pushed
the
feat/adopt-dig-logging
branch
from
July 17, 2026 04:23
cb8dfac to
29ca8d0
Compare
MichaelTaylor3d
marked this pull request as ready for review
July 17, 2026 04:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the dig-node side of DIG-Network/dig_ecosystem#553.
What changed
Before this PR,
dig_node_core+ its P2P/TLS stack emittedtracingevents butdig-node-serviceinstalled no subscriber — every event was silently dropped and a Windows-service run produced no log at all. This adopts the shareddig-loggingcrate (crates.io^0.1):entrypoint::block_on_serve(foregroundrun/ unix daemon) andwin_service::run_service(the Windows service body, which has no console). One-shot CLI commands do not install it. TheLogGuardlives in a process-globalOnceLock(logging.rs) sincetracinghas one global subscriber per process and the guard must outlive the process; this also givescontrol.log.setLevelthe reload handle without threading it throughserve.control.log.setLevel— new gated control method that live-swaps the level filter via the dig-logging reload handle (immediate, not persisted).dig-node logs …verbs — mounts dig-logging's sharedpath|tail|level|bundlesubcommand.logs level <filter>persists AND best-effort live-applies to a running node viacontrol.log.setLevel.logging::log_rpc_dispatch(method), which by signature can only see the method name, neverparams(which carry tokens).tests/never_log.rslocks this in.control.log.setLevelrow); DEVELOPMENT_LOG realization added.Log-level distribution (26 migrated sites)
entrypoint.rs/service.rsCLI-error/install-warningeprintln!s are deliberately KEPT (operator console UX for one-shot commands that install no subscriber; documented in the diff). Themain.rsJSON-envelopeprintln!s are untouched (the §6.2 machine contract).Never-log test
tests/never_log.rs::rpc_dispatch_logging_records_method_but_never_the_request_token+::emitted_records_never_contain_seed_or_token_sentinels(capturing subscriber, sentinel mnemonic + token asserted absent).Version
0.38.0 — MINOR (
feat:, backwards-compatible new capability: new control method + CLI verbs + logging; no breaking change).Blast radius (gitnexus/socratic)
dispatch_control(control.rs) +CONTROL_METHODS+cli_covered_control_methods(drift test), theserve/runbring-up path (server.rs, win_service.rs, tls.rs, self_heal.rs), and therpchandler dispatch. No public read-plane API changed; the new control method is additive/optional (extension unaffected). The engine cratedig_node_coreis unchanged — its existingtracingevents are now simply captured.Verification
Local (
CARGO_TARGET_DIRon a short path for Windows MAX_PATH):cargo build -p dig-node-serviceOK;cargo fmt --all --checkclean;cargo clippy -p dig-node-service --all-targetsclean;cargo test -p dig-node-service --lib --test never_log→ 209 + 2 passed.Co-Authored-By: Claude noreply@anthropic.com