Skip to content

Commit

Permalink
add enable for caller
Browse files Browse the repository at this point in the history
  • Loading branch information
wwj31 committed Aug 27, 2023
1 parent 315e609 commit 4a1f29f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Option struct {
DisplayConsole bool // 是否在控制台显示
Skip int // 跳过的栈底
ExtraWriter []io.Writer // 扩展输出
Caller bool // 是否带上调用文件
}

func New(opt Option) *Logger {
Expand Down Expand Up @@ -67,7 +68,7 @@ func New(opt Option) *Logger {
sugar := zap.New(zcore,
zap.AddStacktrace(zap.ErrorLevel),
zap.AddCallerSkip(opt.Skip),
zap.AddCaller(),
zap.WithCaller(opt.Caller),
).Sugar()

logger := &Logger{
Expand Down

0 comments on commit 4a1f29f

Please sign in to comment.