Skip to content

Commit

Permalink
feat: add alias log GetLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
mabdh committed Sep 10, 2023
1 parent dff8984 commit 24ce42c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,7 @@ type Logger interface {

// Writer used to print logs
Writer() io.Writer

// GetLevel is an alias of Level()
GetLevel() string
}
4 changes: 4 additions & 0 deletions log/logrus.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func (l *Logrus) Level() string {
return l.log.Level.String()
}

func (l *Logrus) GetLevel() string {
return l.Level()
}

func (l *Logrus) Writer() io.Writer {
return l.log.Writer()
}
Expand Down
5 changes: 5 additions & 0 deletions log/noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ func (n *Noop) Fatal(msg string, args ...interface{}) {}
func (n *Noop) Level() string {
return "unsupported"
}

func (n *Noop) GetLevel() string {
return n.Level()
}

func (n *Noop) Writer() io.Writer {
return ioutil.Discard
}
Expand Down
4 changes: 4 additions & 0 deletions log/zap.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func (z Zap) Level() string {
return z.conf.Level.String()
}

func (z Zap) GetLevel() string {
return z.Level()
}

func (z Zap) Writer() io.Writer {
panic("not supported")
}
Expand Down

0 comments on commit 24ce42c

Please sign in to comment.