Skip to content

Make log level configurable via NB_LOG_LEVEL #90

Description

@mayankpande88

The log level is hardcoded to slog.LevelInfo in cmd/main.go:26. Operators cannot enable debug logging to troubleshoot without rebuilding the binary.

Proposed scope

  • Add a log_level field (LogLevel string) to Config in pkg/config/config.go, bound to NB_LOG_LEVEL (via v.BindEnv + v.SetDefault("log_level", "info")).
  • Add a small helper parseLogLevel(string) slog.Level supporting debug / info / warn / error (case-insensitive). Unknown value → fall back to info and log a warning.
  • Use the parsed level in the slog.NewJSONHandler options in cmd/main.go.

Acceptance criteria

  • Unit test for parseLogLevel covering each valid level plus an invalid value.
  • NB_LOG_LEVEL=debug produces debug output; default behavior (info) unchanged.
  • New log_level key documented in docs/configuration.md.

Pointers

  • cmd/main.go:25-28 (handler construction)
  • pkg/config/config.go (config struct + Load bindings)

Good first issue: self-contained, no live infrastructure needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgoPull requests that update go codegood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions