Skip to content

feat(loggers): add configurable log level (#56) - #324

Merged
lerenn merged 1 commit into
mainfrom
feat/56-logger-level
Jun 12, 2026
Merged

lerenn merged 1 commit into
mainfrom
feat/56-logger-level

Conversation

@lerenn

@lerenn lerenn commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Issue

Fixes #56 — the provided loggers had no way to set a severity threshold; every message was always emitted.

Change

Adds a non-breaking WithLevel(...) functional option to the Text and ECS loggers:

  • LevelInfo (default) — logs info, warning and error (unchanged behavior)
  • LevelWarning — logs warning and error only
  • LevelError — logs error only

NewText() / NewECS() keep working with no arguments. A shared Option type lets WithLevel apply to either logger.

Test

level_test.go captures stdout and asserts that lower-severity messages are discarded at each level and that the default logs everything. It fails to compile before the change (no WithLevel/Level*) and passes after.

🤖 Generated with Claude Code

Add a non-breaking WithLevel option to the provided Text and ECS loggers
so messages below the configured severity are discarded. Defaults to
LevelInfo (logs everything), preserving current behavior.

Fixes #56

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lerenn
lerenn merged commit ec73faa into main Jun 12, 2026
5 checks passed
@lerenn
lerenn deleted the feat/56-logger-level branch June 12, 2026 15:02
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.

Add log level to existing loggers

1 participant