diff --git a/Cargo.toml b/Cargo.toml index dbc390f..e678675 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,10 @@ parking_lot = { version = "0.12", optional = true } paste = { version = "1.0" } serde = { version = "1.0", features = ["derive"], optional = true } serde_json = { version = "1.0", optional = true } -time = { version = "0.3", features = ["formatting", "parsing"], optional = true } +time = { version = "0.3", features = [ + "formatting", + "parsing", +], optional = true } [[example]] name = "simple_stdio" diff --git a/examples/json_stdio.rs b/examples/json_stdio.rs index cd4fca6..11dc1f0 100644 --- a/examples/json_stdio.rs +++ b/examples/json_stdio.rs @@ -20,7 +20,7 @@ use logforth::SimpleJsonLayout; use logforth::StdoutAppend; fn main() { - let append = StdoutAppend::new().with_layout(SimpleJsonLayout); + let append = StdoutAppend::default().with_layout(SimpleJsonLayout); let append = DispatchAppend::new(append).filter(LogLevelFilter::new(LevelFilter::Trace)); Logger::new().add_append(append).apply().unwrap(); diff --git a/examples/no_color_stdio.rs b/examples/no_color_stdio.rs index 3c8ef22..276d761 100644 --- a/examples/no_color_stdio.rs +++ b/examples/no_color_stdio.rs @@ -19,7 +19,7 @@ use logforth::Logger; use logforth::StdoutAppend; fn main() { - let append = StdoutAppend::new(); + let append = StdoutAppend::default(); let append = DispatchAppend::new(append).filter(LogLevelFilter::new(LevelFilter::Trace)); Logger::new().add_append(append).apply().unwrap(); diff --git a/examples/rolling_file.rs b/examples/rolling_file.rs index f570158..713165c 100644 --- a/examples/rolling_file.rs +++ b/examples/rolling_file.rs @@ -25,6 +25,9 @@ use logforth::SimpleJsonLayout; fn main() { let rolling = RollingFileWriter::builder() .rotation(Rotation::Minutely) + .filename_prefix("example") + .filename_suffix("log") + .max_log_files(2) .build("logs") .unwrap(); let (writer, _guard) = NonBlockingBuilder::default().finish(rolling); diff --git a/examples/simple_stdio.rs b/examples/simple_stdio.rs index d5a264d..3c11a74 100644 --- a/examples/simple_stdio.rs +++ b/examples/simple_stdio.rs @@ -20,7 +20,7 @@ use logforth::SimpleTextLayout; use logforth::StdoutAppend; fn main() { - let append = StdoutAppend::new().with_layout(SimpleTextLayout::default()); + let append = StdoutAppend::default().with_layout(SimpleTextLayout::default()); let append = DispatchAppend::new(append).filter(LogLevelFilter::new(LevelFilter::Trace)); Logger::new().add_append(append).apply().unwrap(); diff --git a/src/append/file/README.md b/src/append/file/README.md new file mode 100644 index 0000000..8bd36fb --- /dev/null +++ b/src/append/file/README.md @@ -0,0 +1,3 @@ +# Rolling File Appender + +This appender is a fork of [tracing-appender](https://crates.io/crates/tracing-appender), with significant simplifications to fit this crate's needs. diff --git a/src/append/file/rolling.rs b/src/append/file/rolling.rs index fa22a75..e26af13 100644 --- a/src/append/file/rolling.rs +++ b/src/append/file/rolling.rs @@ -71,6 +71,12 @@ pub struct RollingFileWriterBuilder { max_files: Option, } +impl Default for RollingFileWriterBuilder { + fn default() -> Self { + Self::new() + } +} + impl RollingFileWriterBuilder { #[must_use] pub const fn new() -> Self {