mailcow-admin-aliases/internal/logging/logger.go
2024-07-24 17:36:01 +02:00

21 lines
339 B
Go

package logging
import (
"log/slog"
"os"
)
func NewSlogLogger(quiet bool, verbose bool) {
slogLevel := slog.LevelInfo
if quiet {
slogLevel = slog.LevelError
}
if verbose {
slogLevel = slog.LevelDebug
}
handler := slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: slogLevel})
slog.SetDefault(slog.New(handler))
}