Skip to content

Commit

Permalink
add fatal level in logger (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
hunter-bera authored Jan 25, 2024
1 parent 40484dd commit 065adeb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ type Logger interface {
// With returns a new wrapped logger with additional context provided by a set
With(keyVals ...any) Logger

// Fatal takes a message and a set of key/value pairs and logs with level FATAL.
Fatal(msg string, keyVals ...any)

// Impl returns the underlying logger implementation
// It is used to access the full functionalities of the underlying logger
// Advanced users can type cast the returned value to the actual logger
Expand Down Expand Up @@ -64,6 +67,11 @@ func (l zeroLogWrapper) Debug(msg string, keyVals ...interface{}) {
l.Logger.Debug().Fields(keyVals).Msg(msg)
}

// Fatal takes a message and a set of key/value pairs and logs with level FATAL.
func (l zeroLogWrapper) Fatal(msg string, keyVals ...interface{}) {
l.Logger.Fatal().Fields(keyVals).Msg(msg)
}

// With returns a new wrapped logger with additional context provided by a set.
func (l zeroLogWrapper) With(keyVals ...interface{}) Logger {
logger := l.Logger.With().Fields(keyVals).Logger()
Expand Down

0 comments on commit 065adeb

Please sign in to comment.