[#1437] logger: Add caller skip to log original caller position
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m36s
DCO action / DCO (pull_request) Successful in 1m50s
Vulncheck / Vulncheck (pull_request) Successful in 2m19s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m34s
Build / Build Components (pull_request) Successful in 2m49s
Tests and linters / gopls check (pull_request) Successful in 3m6s
Tests and linters / Staticcheck (pull_request) Successful in 3m15s
Tests and linters / Lint (pull_request) Successful in 3m56s
Tests and linters / Tests (pull_request) Successful in 4m44s
Tests and linters / Tests with -race (pull_request) Successful in 5m36s
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m36s
DCO action / DCO (pull_request) Successful in 1m50s
Vulncheck / Vulncheck (pull_request) Successful in 2m19s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m34s
Build / Build Components (pull_request) Successful in 2m49s
Tests and linters / gopls check (pull_request) Successful in 3m6s
Tests and linters / Staticcheck (pull_request) Successful in 3m15s
Tests and linters / Lint (pull_request) Successful in 3m56s
Tests and linters / Tests (pull_request) Successful in 4m44s
Tests and linters / Tests with -race (pull_request) Successful in 5m36s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
7429553266
commit
612b34d570
1 changed files with 3 additions and 2 deletions
|
@ -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)),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue