Beggin to log

This commit is contained in:
Oupson 2020-08-27 17:05:28 +02:00
parent bd638e3d23
commit e4d838d1fe
5 changed files with 19 additions and 3 deletions

3
.gitignore vendored
View File

@ -4,4 +4,5 @@
/logging/
Cargo.lock
Conf.toml
/data
/data
/log

View File

@ -20,4 +20,6 @@ async-trait = "0.1.36"
tokio = { version = "0.2", features = ["full"] }
futures = "0.3"
chrono = "0.4.15"
serde_json = "1.0"
serde_json = "1.0"
log = "0.4"
log4rs = "0.13.0"

12
log4rs.yaml Normal file
View File

@ -0,0 +1,12 @@
appenders:
stdout:
kind: console
file-debug:
kind: file
path: "log/debug.log"
encoder:
pattern: "{d} - {m}{n}"
root:
level: debug
appenders:
- stdout

View File

@ -2,7 +2,7 @@
macro_rules! debugln {
($($arg:tt)*) => {
if cfg!(debug_assertions) {
eprintln!($($arg)*);
log::debug!($($arg)*);
}
};
}

View File

@ -51,6 +51,7 @@ impl TypeMapKey for ShardManagerContainer {
// TODO USE LOG
#[tokio::main]
async fn main() -> IoResult<()> {
log4rs::init_file("log4rs.yaml", Default::default()).unwrap();
let conf: config::Conf = toml::from_str(&std::fs::read_to_string("Conf.toml")?)?;
debugln!("conf : {:?}", conf);