logrus
logrus copied to clipboard
`entry.Log(logrus.FatalLevel, "fatal level")` doesn't call `logger.Exit(1)`
- I found a bug that
entry.Log
doesn't calllogger.Exit(1)
. - If I call
entry.Log
withlogrus.FatalLevel
, system doesn't exit.
in entry.log
only level <= PanicLevel
will lead to panic

FatalLevel
is bigger than PanicLevel

I mean System.Exit(1)
not panic. As second picture that you attatched, FatalLevel
should calls logger.Exit(1)
I mean
System.Exit(1)
not panic. As second picture that you attatched,FatalLevel
should callslogger.Exit(1)
I have check the code,this is a demo,work as expect.
check this demo.
As I described in issue, I call entry.Log(log.FatalLevel, "fatal")
but it didn't call System.Exit(1)
i read the code
- call
entry.Fatal
this function will callentry.logger.Exit
- call
entry.Log
, this function only panic whenlevel <= PanicLevel
, so it withFatalLevel
will not exit program.
Maybe this is by design @sirupsen
Anyway, if this is a bug, i can fix it
This is not a bug. It works as documented:
~/src/logrus$ go doc . Entry.Log
package logrus // import "github.com/sirupsen/logrus"
func (entry *Entry) Log(level Level, args ...interface{})
Log will log a message at the level given as parameter. Warning: using Log
at Panic or Fatal level will not respectively Panic nor Exit. For this
behaviour Entry.Panic or Entry.Fatal should be used instead.