chore(logging): trim default log volume — reclassify routine info→debug, add trace tier#3994
Conversation
…ug, add trace tier Container logs were unusable for support because ~1,450 server-side logger.info calls print at the production default level. Almost all of the high-frequency ones — per-packet, per-request, per-message, and periodic scheduler activity, plus the ~60-line environment dump on every boot — are routine and belong at debug. Changes: - logger.ts: add a `trace` level below `debug` for true per-packet firehose; document the tier semantics (info = sparse, support-relevant events only). - environment.ts: accept `trace` for LOG_LEVEL; collapse the boot env dump to a compact ~16-line info summary (details → debug). - Reclassify server logger.info calls: non-migration info 1452 → 865 (~590 demoted to debug, 11 to trace). Hot paths collapsed: meshtasticManager 258→18, meshcoreManager 61→19, server.ts 49→20. - Redact MeshCore message bodies from logs (contact/channel/room/DM/auto-ack text → `(N chars)`); keep sender/channel metadata. - Docs + docker-compose.yml + CHANGELOG updated; new trace-level test coverage. An idle container is now near-silent at the default `info` level. Raise with LOG_LEVEL=debug (or trace) — no NODE_ENV change needed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015AFBA76hsjqhsXe1BdnYub
|
Claude finished @Yeraze's task —— View job PR Review: chore(logging): trim default log volumeTasks:
Code ReviewThis is a well-scoped, well-executed PR. The signal-to-noise improvement is significant and the changes are conservative. Notes below are roughly priority-ordered. Issues / Concerns1.
2.
3. Privacy/redaction pattern in The message body redaction uses 4.
5. No test for
6.
Positive Observations
SummaryThe PR is ready to merge with one optional quick fix:
The core goal — making an idle container near-silent at |
…l eval, cover trace in sanitization test Addresses non-blocking notes from claude-review on #3994: - logger.ts: comment why trace uses unknown[] (lint baseline) and why currentLevel is import-time only (tests need vi.resetModules()). - logger.test.ts: exercise logger.trace through the CWE-117 sanitization path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015AFBA76hsjqhsXe1BdnYub
|
Thanks for the thorough review. Addressed in 3d0ddb7:
Intentional / no change:
|
|
Claude finished @Yeraze's task —— View job PR Review: chore(logging): trim default log volumeTasks:
Follow-up Review (post 3d0ddb7)All three items from the previous review that the author committed to addressing are correctly implemented. Here's the full current-state assessment. Verified Fixes#1 (trace #2 ( #5 (trace sanitization test) — Confirmed Intentional Items (no change needed)
Minor Observation (no action required)
Doc Quality
SummaryThis PR is ready to merge. The previous review's actionable items (#1, #2, #5) have been addressed correctly, and the intentionally-left-as-is items (#3, #4, #6) remain well-justified. The core goal — a near-silent idle container at |
Problem
Users reported MeshMonitor's Docker logs are unusable for support — too much output at the default level. Root cause is not the logging infrastructure (
src/utils/logger.tsis a proper leveled logger gated byLOG_LEVEL, prod defaultinfo, and server code has zero rawconsole.log). The problem is overuse oflogger.info: ~1,450 server-sideinfocalls all print at the production default, most of them routine per-packet / per-request / per-message / periodic-scheduler chatter, plus a ~60-line environment dump on every boot.Changes
tracelevel belowdebugfor the true per-packet firehose.LOG_LEVELnow acceptstrace.logger.info→debug/trace: non-migrationinfo1,452 → 865 (~590 → debug, 11 → trace). Hot paths collapsed:meshtasticManager258→18,meshcoreManager61→19,environment67→16,server.ts49→20.info: only startup/shutdown, source connect/disconnect, backups/restores/migrations, and deliberate admin actions (purges, config imports, token issuance, upgrades). An idle container is now near-silent atinfo.info— now demoted todebugand redacted to(N chars), keeping only sender/channel metadata.infosummary; per-variable detail →debug.docs/configuration/index.md(trace tier + "info is now quiet" guidance), commentedLOG_LEVELindocker-compose.yml, CHANGELOG entry, new trace-level test coverage.Deliberately out of scope
infolines only fire once when a migration first applies (a one-time audit trail), never in steady state.info(notwarn), per design discussion —infoshould remain a meaningful, sparse support signal.How to use higher verbosity
No
NODE_ENVchange needed:Verification
npm run typecheck— cleannpm run lint:ci(ratchet) — OK (tracetypedunknown[], does not grow theno-explicit-anybaseline)🤖 Generated with Claude Code