Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print FatalLevel log, exit function will not be called? #1078

Closed
edoger opened this issue Dec 10, 2019 · 2 comments · Fixed by #1283
Closed

Print FatalLevel log, exit function will not be called? #1078

edoger opened this issue Dec 10, 2019 · 2 comments · Fixed by #1283

Comments

@edoger
Copy link
Contributor

edoger commented Dec 10, 2019

l := logrus.New()
l.ExitFunc = func(int) { fmt.Println("exit") }

l.Log(logrus.FatalLevel, "test") // The exit function was not called!
l.Fatal("test") // The exit function is called!

Designed so?

@kaedys
Copy link

kaedys commented Dec 10, 2019

(Logger).Log(logrus.FatalLevel, ...) also will not actually exit the program. (Logger).Fatal literally just called (Logger).Log(FatalLevel) followed by (Logger).Exit(1). So it makes sense that an isolated call to Log(), even with the FatalLevel specified, would not call the exit func, because it is also not terminating the program, unlike Fatal().

Edit: related: #993

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants