From 5630f12e51884846edd71ec52766b68fbe74938e Mon Sep 17 00:00:00 2001 From: asxalex Date: Fri, 1 Mar 2024 15:29:16 +0800 Subject: [PATCH] tracing level --- benches/my_bench.rs | 2 +- examples/tracing-log/main.rs | 2 +- src/lib.rs | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/benches/my_bench.rs b/benches/my_bench.rs index aa1232e..5f3846e 100644 --- a/benches/my_bench.rs +++ b/benches/my_bench.rs @@ -8,7 +8,7 @@ fn do_log() { debug!("debug"); } fn criterion_benchmark(c: &mut Criterion) { - let _guard = default(false, false); + let _guard = default(false, false, tracing::Level::DEBUG); c.bench_function("log", |b| b.iter(|| do_log())); } diff --git a/examples/tracing-log/main.rs b/examples/tracing-log/main.rs index b1e08db..7654ad0 100644 --- a/examples/tracing-log/main.rs +++ b/examples/tracing-log/main.rs @@ -2,6 +2,6 @@ use rolling_file::default; mod submod; fn main() { - let _guard = default(false, false); + let _guard = default(false, false, tracing::Level::DEBUG); submod::do_record(); } diff --git a/src/lib.rs b/src/lib.rs index 1e67cf9..6d46ed0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -245,12 +245,13 @@ pub fn new_log>( pub fn default( with_filename: bool, with_line_number: bool, + level: tracing::Level, ) -> tracing_appender::non_blocking::WorkerGuard { new_log( "./.output", 7, PeriodGap::Daily, - tracing::Level::DEBUG, + level, with_filename, with_line_number, )