Skip to content

Commit

Permalink
added panic
Browse files Browse the repository at this point in the history
  • Loading branch information
muraliens committed Jul 9, 2022
1 parent 2ab5cb3 commit 75eb585
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions newlogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 75eb585

Please sign in to comment.