Exit on log.Fatal (#1297)
This commit is contained in:
parent
6d803d9e45
commit
9386f36a13
@ -1,5 +1,7 @@
|
|||||||
package logger
|
package logger
|
||||||
|
|
||||||
|
import "os"
|
||||||
|
|
||||||
type Helper struct {
|
type Helper struct {
|
||||||
Logger
|
Logger
|
||||||
fields map[string]interface{}
|
fields map[string]interface{}
|
||||||
@ -51,10 +53,12 @@ func (h *Helper) Errorf(template string, args ...interface{}) {
|
|||||||
|
|
||||||
func (h *Helper) Fatal(args ...interface{}) {
|
func (h *Helper) Fatal(args ...interface{}) {
|
||||||
h.Logger.Fields(h.fields).Log(ErrorLevel, args...)
|
h.Logger.Fields(h.fields).Log(ErrorLevel, args...)
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Helper) Fatalf(template string, args ...interface{}) {
|
func (h *Helper) Fatalf(template string, args ...interface{}) {
|
||||||
h.Logger.Fields(h.fields).Logf(ErrorLevel, template, args...)
|
h.Logger.Fields(h.fields).Logf(ErrorLevel, template, args...)
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Helper) WithError(err error) *Helper {
|
func (h *Helper) WithError(err error) *Helper {
|
||||||
|
Loading…
Reference in New Issue
Block a user