-
Notifications
You must be signed in to change notification settings - Fork 47
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
How to flush the logger. #33
Comments
I'd say this is an oversight: https://github.com/borntyping/rust-simple_logger/blob/master/src/lib.rs#L233 As this logger only writes to |
Yeah worked around it by flushing stdout. If possible flushing on Drop might be a decent solution? |
The use simple_logger::SimpleLogger;
fn main() {
SimpleLogger::new().init().unwrap();
log::warn!("This is an example message.");
log::logger().flush();
} |
Thanks I have been using the workaround to flush stdout but will switch over to this the next time I need to update the lambda in question. :) |
I am trying to setup a AWS Lambda where I wanted to use simple_logger as my logging facility but it seems that I need to flush the logger before the lambda shutsdown otherwise I will get buffered but not yet written messages printed in the lamda logs.
The log::Log trait does expose a flush method but as init only returns a unit value I do not have access to the flogger to call flush on it.
Is this an oversight or should I look for a different library for my logging needs?
The text was updated successfully, but these errors were encountered: