Files
uptimesebi/internal/platform/log.go
T
Sebastian UnterschützandClaude Opus 5.5 d20225982a refactor: follow the google go style guide
Document every package and exported identifier, return the log level
from NewLogger instead of keeping it in a package variable, and stop
tests from mutating the argon2 parameters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
2026-11-22 00:18:02 +01:00

20 lines
622 B
Go

package platform
import (
"log/slog"
"os"
"git.zb-server.de/ZB-Server/uptimesebi/internal/buildinfo"
)
// NewLogger returns a JSON logger tagged with component and the release
// version, and the level variable controlling it. The level can be changed
// once configuration is loaded; the logger is needed before that to report
// configuration errors.
func NewLogger(component string) (*slog.Logger, *slog.LevelVar) {
level := new(slog.LevelVar)
l := slog.New(slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{Level: level})).
With("component", component, "app_version", buildinfo.Version)
return l, level
}