Commit 7080f81
feat(kernel-cli): filter daemon log entries below a minimum severity (#1008)
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](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!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.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
66dc26d. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent 9cdc6ec commit 7080f81
2 files changed
Lines changed: 41 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
14 | 44 | | |
15 | 45 | | |
16 | 46 | | |
17 | 47 | | |
18 | | - | |
| 48 | + | |
19 | 49 | | |
20 | 50 | | |
21 | 51 | | |
| |||
139 | 169 | | |
140 | 170 | | |
141 | 171 | | |
142 | | - | |
| 172 | + | |
| 173 | + | |
143 | 174 | | |
144 | 175 | | |
| 176 | + | |
| 177 | + | |
145 | 178 | | |
146 | 179 | | |
147 | | - | |
| 180 | + | |
| 181 | + | |
148 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
149 | 186 | | |
150 | 187 | | |
151 | 188 | | |
| |||
0 commit comments