generated from PlexSheep/baserepo
refactor(log): make logfile kinda behave like normal
cargo devel CI / cargo CI (push) Has been cancelled
Details
cargo devel CI / cargo CI (push) Has been cancelled
Details
This commit is contained in:
parent
492e655d29
commit
54a694645f
|
@ -151,14 +151,23 @@ impl LoggerBuilder {
|
||||||
));
|
));
|
||||||
if self.log_to_file {
|
if self.log_to_file {
|
||||||
tracing_subscriber::registry()
|
tracing_subscriber::registry()
|
||||||
.with(
|
.with(layer.and_then({
|
||||||
layer.and_then(
|
tracing_subscriber::fmt::layer()
|
||||||
tracing_subscriber::fmt::layer().with_writer(
|
.with_writer(
|
||||||
self.logfile()?
|
self.logfile()?
|
||||||
.expect("logging to file is requested but logfile returned None"),
|
.expect("logging to file is requested but logfile returned None"),
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
.with_ansi(self.ansi)
|
||||||
|
.with_target(self.display_target)
|
||||||
|
.with_file(self.display_filename)
|
||||||
|
.with_thread_ids(self.display_thread_ids)
|
||||||
|
.with_line_number(self.display_line_number)
|
||||||
|
.with_thread_names(self.display_thread_names)
|
||||||
|
.with_span_events(self.span_events.clone())
|
||||||
|
.with_filter(tracing::level_filters::LevelFilter::from_level(
|
||||||
|
self.max_level,
|
||||||
|
))
|
||||||
|
}))
|
||||||
.init();
|
.init();
|
||||||
} else {
|
} else {
|
||||||
tracing_subscriber::registry().with(layer).init();
|
tracing_subscriber::registry().with(layer).init();
|
||||||
|
|
Reference in New Issue