Skip to content

Commit

Permalink
fix new log error
Browse files Browse the repository at this point in the history
  • Loading branch information
feyman committed Apr 11, 2023
1 parent 87fbb10 commit 728c1bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,18 @@ func NewLogger(options Options) (*zap.Logger, error) {
}
var err error
// 生成 baseLogger
baseLogger, err = cfg.Build()
logger, err := cfg.Build()
if err != nil {
return nil, err
}

// 设置 baseLogger 名字,没有传参使用默认名字
if options.Name != "" {
baseLogger = baseLogger.Named(options.Name)
logger = logger.Named(options.Name)
} else {
baseLogger = baseLogger.Named(defaultLoggerName)
logger = logger.Named(defaultLoggerName)
}
return baseLogger, nil
return logger, nil
}

// CloneLogger return the global baseLogger copy which add a new name
Expand Down

0 comments on commit 728c1bf

Please sign in to comment.