Skip to content

feat(kernel-cli): filter daemon log entries below a minimum severity - #1008

Merged
FUDCo merged 3 commits into
mainfrom
chip/kernel-cli-daemon-logging
Aug 5, 2026
Merged

feat(kernel-cli): filter daemon log entries below a minimum severity#1008
FUDCo merged 3 commits into
mainfrom
chip/kernel-cli-daemon-logging

Conversation

@FUDCo

@FUDCo FUDCo commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Small, self-contained quality-of-life change to the daemon's log transport, extracted from chip/orchestration-demo. Independent of the kernel work in #1007 — this branches off main directly rather than stacking.

Problem

daemon.log recorded every level. In practice debug output — refcount churn especially — dominated the file badly enough to make it hard to read while debugging anything else. On a busy daemon the signal you actually want is buried.

Change

The file transport drops entries below a minimum severity, defaulting to info. Set $OCAP_DAEMON_LOG_LEVEL=debug to record everything again.

Two details worth a reviewer's eye:

  • LOG_LEVELS mirrors @metamask/logger's level ordering locally because logLevels isn't part of that package's public surface. If it's ever exported, this should switch to importing it rather than keeping a copy in sync.
  • It's declared above the file-scope logger construction deliberately. The transport factory is invoked during module init, so a later declaration would put LOG_LEVELS in its temporal dead zone at exactly the moment it's read.

Not included

The fatal-path handler work that lives in the same file is already on main (#966), so this PR touches only the level-filtering lines.

Validation

@metamask/kernel-cli builds, lints, and its tests pass. Changelog entry follows in a second commit once this PR has a number to link to.

🤖 Generated with Claude Code


Note

Low Risk
Observability-only change to log file filtering; no auth, RPC, or persistence behavior is affected.

Overview
daemon.log now skips entries below a minimum severity (default info) in the daemon file transport, so noisy debug lines no longer bury useful output.

The threshold comes from OCAP_DAEMON_LOG_LEVEL; set it to debug to record all levels again. makeFileTransport compares each entry against a local LOG_LEVELS map (mirroring @metamask/logger ordering, since levels aren’t exported). Changelog documents the behavior change.

Reviewed by Cursor Bugbot for commit 66dc26d. Bugbot is set up for automated code reviews on this repo. Configure here.

FUDCo and others added 2 commits August 4, 2026 16:58
The daemon log was recording every level, and high-volume `debug` output
(refcount churn and similar) dominated `daemon.log` to the point of making
it hard to read while debugging anything else.

The file transport now drops entries below a minimum severity, defaulting
to `info`; set `$OCAP_DAEMON_LOG_LEVEL` to `debug` to record everything
again. `LOG_LEVELS` mirrors @metamask/logger's ordering because `logLevels`
is not part of that package's public surface, and it is declared above the
file-scope logger construction so the transport factory does not hit a
temporal-dead-zone reference when called during module init.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 71.31%
⬇️ -0.05%
8890 / 12465
🔵 Statements 71.14%
⬇️ -0.05%
9041 / 12707
🔵 Functions 72.46%
⬇️ -0.02%
2142 / 2956
🔵 Branches 64.82%
⬇️ -0.07%
3595 / 5546
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/kernel-cli/src/commands/daemon-entry.ts 0%
🟰 ±0%
0%
🟰 ±0%
0%
🟰 ±0%
0%
🟰 ±0%
19-240
Generated in workflow #4576 for commit 66dc26d by the Vitest Coverage Report Action

@FUDCo
FUDCo marked this pull request as ready for review August 5, 2026 01:21
@FUDCo
FUDCo requested a review from a team as a code owner August 5, 2026 01:21
@FUDCo
FUDCo added this pull request to the merge queue Aug 5, 2026
Merged via the queue into main with commit 7080f81 Aug 5, 2026
33 checks passed
@FUDCo
FUDCo deleted the chip/kernel-cli-daemon-logging branch August 5, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants