Logger with context #1437

Merged
fyrchik merged 8 commits from dstepanov-yadro/frostfs-node:feat/log_with_ctx into master 2024-11-20 15:43:53 +00:00
Showing only changes of commit 612b34d570 - Show all commits

View file

@ -131,6 +131,7 @@ func newConsoleLogger(prm *Prm) (*Logger, error) {
lZap, err := c.Build(
zap.AddStacktrace(zap.NewAtomicLevelAt(zap.FatalLevel)),
zap.AddCallerSkip(1),
)
if err != nil {
return nil, err
@ -167,7 +168,7 @@ func newJournaldLogger(prm *Prm) (*Logger, error) {
zapjournald.SyslogPid(),
})
lZap := zap.New(coreWithContext, zap.AddStacktrace(zap.NewAtomicLevelAt(zap.FatalLevel)))
lZap := zap.New(coreWithContext, zap.AddStacktrace(zap.NewAtomicLevelAt(zap.FatalLevel)), zap.AddCallerSkip(1))
l := &Logger{z: lZap, lvl: lvl}
prm._log = l
@ -190,6 +191,6 @@ func (l *Logger) With(fields ...zap.Field) *Logger {
func NewLoggerWrapper(z *zap.Logger) *Logger {
return &Logger{
z: z,
z: z.WithOptions(zap.AddCallerSkip(1)),
}
}