Skip to content

Commit

Permalink
fixed skip stack caller
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
  • Loading branch information
fredbi committed Nov 15, 2023
1 parent bc9ac89 commit 917f45f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions log/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type (
// NewFactory creates a new logger Factory for an underlying zap logger.
func NewFactory(logger *zap.Logger, opts ...Option) Factory {
return Factory{
logger: logger,
logger: logger.WithOptions(zap.AddCallerSkip(1)),
options: defaultOptions(opts),
}
}
Expand Down Expand Up @@ -58,7 +58,7 @@ func (b Factory) For(ctx context.Context) Logger {
}

stx := span.SpanContext()
logger := b.logger.WithOptions(zap.AddCallerSkip(1))
logger := b.logger

if b.datadog {
// for datadog correlation, extract trace/span IDs as fields to add to the log entry.
Expand Down
2 changes: 1 addition & 1 deletion log/logger_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type (

var loggerDefaults = loggerOptions{
logLevel: "info",
callerSkip: 1,
callerSkip: 0,
}

func defaultLoggerOptions(opts []LoggerOption) loggerOptions {
Expand Down

0 comments on commit 917f45f

Please sign in to comment.