Skip to content

Commit

Permalink
Merge pull request #50 from ArtisanCloud/develop
Browse files Browse the repository at this point in the history
fix(logger): NewLogger with return error before defer
  • Loading branch information
Matrix-X authored Oct 12, 2022
2 parents 24ba851 + 37514bf commit 4e552e9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions logger/drivers/zap/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ type Logger struct {
func NewLogger(config *object.HashMap) (logger contract.LoggerInterface, err error) {

zapLogger, err := newZapLogger(config)
defer zapLogger.Sync() // flushes buffer, if any

if err != nil {
return nil, err
}

defer zapLogger.Sync() // flushes buffer, if any

logger = &Logger{
Logger: zapLogger,
sugar: zapLogger.Sugar(),
Expand Down

0 comments on commit 4e552e9

Please sign in to comment.