Add FatalString method, make Fatal take an error

This commit is contained in:
Brian Picciano 2022-05-05 19:17:45 -06:00
parent ba9bc6c46c
commit cbeee71cb1

View File

@ -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))
}