forked from TrueCloudLab/frostfs-node
[#1437] logger: Add caller skip to log original caller position
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
5ffd1541a8
commit
ff1e7b531f
1 changed files with 3 additions and 2 deletions
|
@ -131,6 +131,7 @@ func newConsoleLogger(prm *Prm) (*Logger, error) {
|
||||||
|
|
||||||
lZap, err := c.Build(
|
lZap, err := c.Build(
|
||||||
zap.AddStacktrace(zap.NewAtomicLevelAt(zap.FatalLevel)),
|
zap.AddStacktrace(zap.NewAtomicLevelAt(zap.FatalLevel)),
|
||||||
|
zap.AddCallerSkip(1),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -167,7 +168,7 @@ func newJournaldLogger(prm *Prm) (*Logger, error) {
|
||||||
zapjournald.SyslogPid(),
|
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}
|
l := &Logger{z: lZap, lvl: lvl}
|
||||||
prm._log = l
|
prm._log = l
|
||||||
|
@ -190,6 +191,6 @@ func (l *Logger) With(fields ...zap.Field) *Logger {
|
||||||
|
|
||||||
func NewLoggerWrapper(z *zap.Logger) *Logger {
|
func NewLoggerWrapper(z *zap.Logger) *Logger {
|
||||||
return &Logger{
|
return &Logger{
|
||||||
z: z,
|
z: z.WithOptions(zap.AddCallerSkip(1)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue