diff --git a/logger.go b/logger.go index f7f1fff..6191f0b 100644 --- a/logger.go +++ b/logger.go @@ -142,7 +142,10 @@ type Logger interface { // Emit a message and key/value pairs at the ERROR level Error(msg string, args ...interface{}) - // Emit a message and key/value pairs at the ERROR level + // Emit a message and key/value pairs at the ERROR level & panic + Panic(msg string, args ...interface{}) + + // If err not null Emit a message and panic ErrorPanic(err error, args ...interface{}) // Indicate if TRACE logs would be emitted. This and the other Is* guards diff --git a/newlogger.go b/newlogger.go index 38bfa5e..9f0cdb6 100644 --- a/newlogger.go +++ b/newlogger.go @@ -468,6 +468,12 @@ func (l *newLogger) Error(msg string, args ...interface{}) { l.log(l.Name(), Error, msg, args...) } +// Emit a message and key/value pairs at the ERROR level & panic +func (l *newLogger) Panic(msg string, args ...interface{}) { + l.log(l.Name(), Error, msg, args...) + panic(msg) +} + // Emit the message and args & panic func (l *newLogger) ErrorPanic(err error, args ...interface{}) { if err != nil {