Skip to content

Commit

Permalink
Merge pull request #274 from Azanul/nil-handle
Browse files Browse the repository at this point in the history
nil handle for err
  • Loading branch information
Revolyssup authored Mar 7, 2023
2 parents 3777ce5 + f381645 commit 3a62e8b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ func New(appname string, opts Options) (Handler, error) {
}

func (l *Logger) Error(err error) {
if err == nil {
return
}

l.handler.WithFields(logrus.Fields{
"code": errors.GetCode(err),
"severity": errors.GetSeverity(err),
Expand All @@ -89,6 +93,10 @@ func (l *Logger) Debug(description ...interface{}) {
}

func (l *Logger) Warn(err error) {
if err == nil {
return
}

l.handler.WithFields(logrus.Fields{
"code": errors.GetCode(err),
"severity": errors.GetSeverity(err),
Expand Down

0 comments on commit 3a62e8b

Please sign in to comment.