Skip to content

Commit

Permalink
Exit on log.Fatal (#1297)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-toogood committed Mar 4, 2020
1 parent 6d803d9 commit 9386f36
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions logger/helper.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package logger

import "os"

type Helper struct {
Logger
fields map[string]interface{}
Expand Down Expand Up @@ -51,10 +53,12 @@ func (h *Helper) Errorf(template string, args ...interface{}) {

func (h *Helper) Fatal(args ...interface{}) {
h.Logger.Fields(h.fields).Log(ErrorLevel, args...)
os.Exit(1)
}

func (h *Helper) Fatalf(template string, args ...interface{}) {
h.Logger.Fields(h.fields).Logf(ErrorLevel, template, args...)
os.Exit(1)
}

func (h *Helper) WithError(err error) *Helper {
Expand Down

0 comments on commit 9386f36

Please sign in to comment.