Skip to content

Commit 3782b79

Browse files
committed
feat: [CS-3] output log to console for promtail to collect
1 parent bd69df5 commit 3782b79

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/log/logger.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ var (
1818
func InitLogger() {
1919
writeSyncer := getLogWriter()
2020
encoder := getEncoder()
21-
core := zapcore.NewCore(encoder, writeSyncer, getLogLevel())
21+
fileCore := zapcore.NewCore(encoder, writeSyncer, getLogLevel())
22+
consoleCore := zapcore.NewCore(encoder, zapcore.AddSync(os.Stdout), getLogLevel())
23+
core := zapcore.NewTee(fileCore, consoleCore)
2224
Logger = zap.New(core, zap.AddCaller()).Sugar()
2325
}
2426

0 commit comments

Comments
 (0)