package logger import ( "context" "io" "log/slog" "os" ) // LoggerLevel expresses the desired logging verbosity. Unlike a full log-level // enum, it only distinguishes between a verbose development mode and a quieter // production mode; it is converted to an slog.Level by New. type LoggerLevel int const ( // Development enables debug-level output, suitable for local development. Development LoggerLevel = iota // Production limits output to info level and above. Production ) // toSlogLevel converts a LoggerLevel into the corresponding slog.Level, // defaulting to info for any unrecognized value. func toSlogLevel(level LoggerLevel) slog.Level { switch level { case Development: return slog.LevelDebug case Production: return slog.LevelInfo default: return slog.LevelInfo } } // New creates a *slog.Logger that writes to os.Stderr in the bracketed format // "[