Skip to content

Commit

Permalink
feat: add fatal level for field logger
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-karan committed Jul 1, 2022
1 parent 5b61699 commit 6e8ef3d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions field_logger.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package logf

import "os"

type FieldLogger struct {
fields Fields
logger *Logger
Expand All @@ -23,3 +25,10 @@ func (l *FieldLogger) Warn(msg string) {
func (l *FieldLogger) Error(msg string) {
l.logger.handleLog(msg, ErrorLevel, l.fields)
}

// Fatal emits a fatal level log line.
// It aborts the current program with an exit code of 1.
func (l *FieldLogger) Fatal(msg string) {
l.logger.handleLog(msg, ErrorLevel, l.fields)
os.Exit(1)
}

0 comments on commit 6e8ef3d

Please sign in to comment.