Closed dlsrb6342 closed 2 years ago
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
entry.Fatal
this function will call entry.logger.Exit
entry.Log
, this function only panic when level <= PanicLevel
, so it with FatalLevel
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.
entry.Log
doesn't calllogger.Exit(1)
.entry.Log
withlogrus.FatalLevel
, system doesn't exit.