Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move test to example #337

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.