Exit on log.Fatal (#1297)

This commit is contained in:
ben-toogood 2020-03-04 13:46:01 +00:00 committed by GitHub
parent 6d803d9e45
commit 9386f36a13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,7 @@
package logger
import "os"
type Helper struct {
Logger
fields map[string]interface{}
@ -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 {