Skip to content

Commit e6b2fb2

Browse files
committed
feat: expose zap logger via StdBackend function in logger package; enable direct access to underlying zap instance
Signed-off-by: tbxark <tbxark@outlook.com>
1 parent 289d7b3 commit e6b2fb2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

log/logger.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package log
33
import (
44
"sync/atomic"
55

6+
"go.uber.org/zap"
67
"go.uber.org/zap/zapcore"
78
)
89

@@ -53,6 +54,11 @@ func Init(config *Config, attrs map[string]any) {
5354
))
5455
}
5556

57+
// StdBackend returns the underlying *zap.Logger instance from the global logger.
58+
func StdBackend() *zap.Logger {
59+
return std.Load().logger.Desugar()
60+
}
61+
5662
// Sync flushes any buffered log entries to their destinations.
5763
// This should typically be called before application shutdown to ensure all logs are written.
5864
func Sync() error {

0 commit comments

Comments
 (0)