tracing level

This commit is contained in:
asxalex 2024-03-01 15:29:16 +08:00
parent 0078de5ffe
commit 5630f12e51
3 changed files with 4 additions and 3 deletions

View File

@ -8,7 +8,7 @@ fn do_log() {
debug!("debug"); debug!("debug");
} }
fn criterion_benchmark(c: &mut Criterion) { 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())); c.bench_function("log", |b| b.iter(|| do_log()));
} }

View File

@ -2,6 +2,6 @@ use rolling_file::default;
mod submod; mod submod;
fn main() { fn main() {
let _guard = default(false, false); let _guard = default(false, false, tracing::Level::DEBUG);
submod::do_record(); submod::do_record();
} }

View File

@ -245,12 +245,13 @@ pub fn new_log<P: AsRef<Path>>(
pub fn default( pub fn default(
with_filename: bool, with_filename: bool,
with_line_number: bool, with_line_number: bool,
level: tracing::Level,
) -> tracing_appender::non_blocking::WorkerGuard { ) -> tracing_appender::non_blocking::WorkerGuard {
new_log( new_log(
"./.output", "./.output",
7, 7,
PeriodGap::Daily, PeriodGap::Daily,
tracing::Level::DEBUG, level,
with_filename, with_filename,
with_line_number, with_line_number,
) )