Skip to content

Commit be7c34e

Browse files
committed
log: Use the SimpleHandler by default
Instead of defaulting to slog.defaultHandler, we now use the SimpleHandler which we were already using when SetOutput was called. This produces log messages without the date, so instead of: 2025/08/27 22:15:32 DEBUG Verbosity: 2 It logs: 22:15:32 DEBUG Verbosity: 2
1 parent ee928e2 commit be7c34e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

log/log.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"io"
88
"log/slog"
99
"maps"
10+
"os"
1011
"sync"
1112
"sync/atomic"
1213
)
@@ -20,7 +21,7 @@ type (
2021
)
2122

2223
var logLevelMu = sync.RWMutex{}
23-
var logLevel slog.Level
24+
var logLevel = NoticeLevel
2425

2526
var hasCustomOutput atomic.Pointer[io.Writer]
2627

@@ -64,6 +65,10 @@ var defaultHandlers = map[Level]Handler{
6465
var handlers = maps.Clone(defaultHandlers)
6566
var handlersMu = sync.RWMutex{}
6667

68+
func init() {
69+
SetOutput(os.Stderr)
70+
}
71+
6772
// GetLevel gets the standard logger level.
6873
func GetLevel() Level {
6974
logLevelMu.RLock()

0 commit comments

Comments
 (0)