Skip to content

Commit

Permalink
chore: move old test to example. fix formatting (estk#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
bconn98 authored Jan 24, 2024
1 parent 4f09b8f commit b0ad8ba
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Cargo.lock
.idea/
*.iml
.vscode/
info.log
log/
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,7 @@ required-features = ["console_appender", "file_appender", "rolling_file_appender
[[example]]
name = "compile_time_config"
required-features = ["yaml_format", "config_parsing"]

[[example]]
name = "multi_logger_config"
required-features = ["yaml_format", "config_parsing"]
5 changes: 2 additions & 3 deletions test/log.yml → examples/multi_logger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ appenders:
level: error
file:
kind: file
path: error.log
path: info.log
encoder:
pattern: "{d} [{t}] {l} {M}:{m}{n}"

root:
level: warn
appenders:
- console

loggers:
test::a:
multi_logger_config::a:
level: info
appenders:
- file
Expand Down
23 changes: 23 additions & 0 deletions examples/multi_logger_config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use std::{default::Default, thread, time::Duration};

use log::{error, warn};
use log4rs;

fn main() {
log4rs::init_file("examples/multi_logger.yml", Default::default()).unwrap();

loop {
thread::sleep(Duration::from_secs(1));
warn!("main");
error!("error main");
a::foo();
}
}

mod a {
use log::info;

pub fn foo() {
info!("module a");
}
}
3 changes: 1 addition & 2 deletions src/config/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@
//!
//! # The additivity of the logger. If true, appenders attached to the logger's
//! # parent will also be attached to this logger.
//! #
//! Default: true
//! # Default: true
//! additive: false
//! ```
#![allow(deprecated)]
Expand Down
8 changes: 0 additions & 8 deletions test/Cargo.toml

This file was deleted.

23 changes: 0 additions & 23 deletions test/src/main.rs

This file was deleted.

0 comments on commit b0ad8ba

Please sign in to comment.