Add FatalString method, make Fatal take an error
This commit is contained in:
parent
ba9bc6c46c
commit
cbeee71cb1
13
mlog/mlog.go
13
mlog/mlog.go
@ -356,8 +356,15 @@ func (l *Logger) Error(ctx context.Context, descr string, err error) {
|
|||||||
l.Log(mkErrMsg(ctx, LevelError, descr, err))
|
l.Log(mkErrMsg(ctx, LevelError, descr, err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fatal logs a LevelFatal message. A Fatal message automatically stops the
|
// FatalString logs a LevelFatal message which is only a string. A Fatal message
|
||||||
// process with an os.Exit(1) if the default MessageHandler is used.
|
// automatically stops the process with an os.Exit(1) if the default
|
||||||
func (l *Logger) Fatal(ctx context.Context, descr string) {
|
// MessageHandler is used.
|
||||||
|
func (l *Logger) FatalString(ctx context.Context, descr string) {
|
||||||
l.Log(mkMsg(ctx, LevelFatal, descr))
|
l.Log(mkMsg(ctx, LevelFatal, descr))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fatal logs a LevelFatal message. A Fatal message automatically stops the
|
||||||
|
// process with an os.Exit(1) if the default MessageHandler is used.
|
||||||
|
func (l *Logger) Fatal(ctx context.Context, descr string, err error) {
|
||||||
|
l.Log(mkErrMsg(ctx, LevelFatal, descr, err))
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user