Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun committed Aug 1, 2024
1 parent 2d91b2a commit d4eec62
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/json_stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion examples/no_color_stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
3 changes: 3 additions & 0 deletions examples/rolling_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
3 changes: 3 additions & 0 deletions src/append/file/README.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 6 additions & 0 deletions src/append/file/rolling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ pub struct RollingFileWriterBuilder {
max_files: Option<usize>,
}

impl Default for RollingFileWriterBuilder {
fn default() -> Self {
Self::new()
}
}

impl RollingFileWriterBuilder {
#[must_use]
pub const fn new() -> Self {
Expand Down

0 comments on commit d4eec62

Please sign in to comment.