-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Should it flush the logger? #4
Comments
Flushing the logger before exit is the application's responsibility IMO. In many applications like servers, a panic isn't going to shut down the whole server anyway, since it'll be contained to the offending request. |
Thanks, I hadn't considered the one-thread-of-a-server use-case. But that's not the only possible use, this could be setup on main, for a single-threaded server, no? Doesn't the severity of a |
The threaded-ness of a server doesn't really have anything to do with its approach towards panics, but again, it seems like if an application is worried about this, it can stick a guard object in main that flushes the logger if it wants. |
Thanks and sorry if I'm being a pain here, but: wouldn't such a guard get |
No, the panic handler runs before the program unwinds. You'd need this drop guard anyway if the program has the ability to exit on its own. |
OK, thanks. |
(Found this crate on the way to prototyping a
fatal!
macro in dekellum/tao-log#1, which sort of solves the same problem, but from the opposite direction.)Should the panic handler
flush
the logger after logging the panic? Maybe most logger implementations don't buffer messages, but if any did, then this would be important to persist the log message before terminating?If the answer is no, then feel free to close. If the answer is yes, then would a PR be desired?
The text was updated successfully, but these errors were encountered: