Skip to content

feat(common): filter logs with LOG_LEVEL - #142

Merged
mytrashcan merged 1 commit into
mainfrom
feat/log-level
Oct 20, 2026
Merged

mytrashcan merged 1 commit into
mainfrom
feat/log-level

Conversation

@mytrashcan

Copy link
Copy Markdown
Owner

Change

The shared logger in @openstreamgrid/common, used by the tracker, origin, sidecar writer, Node peer, and SDK, now honors LOG_LEVEL:

  • info (default) writes everything, as before.
  • warn drops info entries.
  • error writes errors only.

Unknown values keep everything, so a typo cannot silence logs. Values are trimmed and case-insensitive. The variable is read through a globalThis.process guard, so browsers, which have no environment, log as before.

Also:

  • Moves createLogger's doc comment back onto it (it had drifted above the segment-pattern constant).
  • Documents LOG_LEVEL at the top of the README configuration section (EN/KO).

Tests

A common test covers warn, ERROR (trimmed and case-folded), an unknown value, and unset. common: 8 pass.

Every service logged at info with no way to quiet it, which is noisy for large audiences. The shared logger now drops entries below LOG_LEVEL (info, warn, or error; default info). Unknown values keep everything, and browsers, which have no environment, log as before. Also moves createLogger's doc comment back onto it.
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests PRs that add or modify tests enhancement New feature or request labels Oct 20, 2026
@mytrashcan

Copy link
Copy Markdown
Owner Author

Self-review:

  • The level check happens before serialization, so dropped entries cost nothing.
  • globalThis.process guarding keeps the browser bundle safe. Unknown values fall back to info, so a typo cannot silence logs.
  • createLogger's doc comment is back on it.
  • CI is green, including the SDK publish dry run.

@mytrashcan
mytrashcan merged commit 8100138 into main Oct 20, 2026
16 checks passed
@mytrashcan
mytrashcan deleted the feat/log-level branch October 20, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request tests PRs that add or modify tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant