From cbeee71cb1eed198da98d34a44cc2ab74f022f40 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 5 May 2022 19:17:45 -0600 Subject: [PATCH] Add FatalString method, make Fatal take an error --- mlog/mlog.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mlog/mlog.go b/mlog/mlog.go index a7f3ddd..1dad225 100644 --- a/mlog/mlog.go +++ b/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)) } -// 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) { +// FatalString logs a LevelFatal message which is only a string. A Fatal message +// automatically stops the process with an os.Exit(1) if the default +// MessageHandler is used. +func (l *Logger) FatalString(ctx context.Context, descr string) { 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)) +}