We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
flexi_logger version
flexi_logger = { version = "0.29.0", features = [ "compress", "colors", "async", ] }
code example
let log_dir = PathBuf::from("logs"); let file_spec = FileSpec::default() .directory(log_dir) .suppress_basename() .suppress_timestamp() .o_suffix(Option::<String>::None) .suffix("log"); let log_to_console_format = |write: &mut dyn std::io::Write, now: &mut DeferredNow, record: &Record| { let time_prefix = now.format("%H:%M:%S"); let binding = std::thread::current(); let thread_name = binding.name().unwrap_or("Unknown thread"); let level = record.level(); let file_name = record .file() .map(|file_path| { Path::new(file_path) .file_name() .unwrap_or_else(|| std::ffi::OsStr::new("<unnamed>")) .to_string_lossy() .into_owned() }) .unwrap_or_else(|| "<unnamed>".to_string()); write!( write, "[{}] [{}/{}]: [{}] {}", style(level).paint(time_prefix.to_string()), style(level).paint(thread_name), style(level).paint(level.to_string()), style(level).paint(file_name), &record.args() ) }; let log_to_file_format = |write: &mut dyn std::io::Write, now: &mut DeferredNow, record: &Record| { let time_prefix = now.format("%H:%M:%S"); let binding = std::thread::current(); let thread_name = binding.name().unwrap_or("Unknown thread"); let level = record.level(); let file_name = record .file() .map(|file_path| { Path::new(file_path) .file_name() .unwrap_or_else(|| std::ffi::OsStr::new("<unnamed>")) .to_string_lossy() .into_owned() }) .unwrap_or_else(|| "<unnamed>".to_string()); write!( write, "[{}] [{}/{}]: [{}] {}", time_prefix.to_string(), thread_name, level.to_string(), file_name, &record.args() ) }; Logger::with(LogSpecification::from(config.log_level)) .log_to_file(file_spec) .rotate( flexi_logger::Criterion::Size(10 * 1024 * 1024), flexi_logger::Naming::TimestampsDirect, flexi_logger::Cleanup::KeepLogAndCompressedFiles(0, 5), ) .set_palette("b1;3;2;4;6".to_string()) .format_for_files(log_to_file_format) .format_for_stderr(log_to_console_format) .duplicate_to_stderr(flexi_logger::Duplicate::Info) .write_mode(flexi_logger::WriteMode::Async) .start() .unwrap()
It outputs _r2024-09-24_16-21-18.log, but I expect is r2024-09-24_16-21-18.log
_r2024-09-24_16-21-18.log
r2024-09-24_16-21-18.log
The text was updated successfully, but these errors were encountered:
Fixed with v0.29.1
Sorry, something went wrong.
No branches or pull requests
flexi_logger version
code example
It outputs
_r2024-09-24_16-21-18.log
, but I expect isr2024-09-24_16-21-18.log
The text was updated successfully, but these errors were encountered: