You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the following code to generate a log file every day, for example, when the date is from January 7, 2025 to January 8, 2025, how to append a string after the file log.log.2025-01-07, such as: “-----file end------”
let file_appender = tracing_appender::rolling::daily("logs", "log.log");
let (non_blocking, _guard) = tracing_appender::non_blocking(file_appender);
let file_layer = fmt::layer()
.with_ansi(false)
.with_file(false)
.with_line_number(true)
.with_thread_ids(false)
.with_thread_names(true)
.with_timer(LocalTimer)
.with_writer(non_blocking)
.with_filter(LevelFilter::INFO);
let collector = tracing_subscriber::registry()
.with(file_layer)
.with(std_layer);
tracing::subscriber::set_global_default(collector).expect("Tracing collect error");
The text was updated successfully, but these errors were encountered:
Use the following code to generate a log file every day, for example, when the date is from January 7, 2025 to January 8, 2025, how to append a string after the file log.log.2025-01-07, such as: “-----file end------”
The text was updated successfully, but these errors were encountered: