From 065adeb0b54a8f27002d49884160e8df1425fb1e Mon Sep 17 00:00:00 2001 From: hunter-bera <133678627+hunter-bera@users.noreply.github.com> Date: Thu, 25 Jan 2024 14:08:46 -0500 Subject: [PATCH] add fatal level in logger (#56) --- log/log.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/log/log.go b/log/log.go index 5e96e62..bb64b8b 100644 --- a/log/log.go +++ b/log/log.go @@ -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 @@ -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()