aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Perry <avaglir@gmail.com>2018-02-14 16:18:37 -0500
committerNathan Perry <avaglir@gmail.com>2018-02-14 16:18:37 -0500
commitbe966678275ea47d72cf5be1340eaba0e281285a (patch)
tree392526ad10c8151949afda6d3521f34c6010a0d8
parentd44b8e167e657cf088c2c28f15159e7de31d5886 (diff)
improve logging
-rw-r--r--.gitignore1
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml4
-rw-r--r--src/main.rs13
4 files changed, 13 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 4fbe3a1..2d48ea0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
**/*.rs.bk
.env
.vscode
+*.log
diff --git a/Cargo.lock b/Cargo.lock
index 374171b..c77d10b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -786,7 +786,7 @@ dependencies = [
]
[[package]]
-name = "thulani-rs"
+name = "thulani"
version = "0.1.0"
dependencies = [
"chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/Cargo.toml b/Cargo.toml
index 94bbed1..0f9a5d0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "thulani-rs"
+name = "thulani"
version = "0.1.0"
authors = ["Nathan Perry <avaglir@gmail.com>"]
@@ -11,10 +11,8 @@ typemap = "0.3.3"
url = "1.6.0"
dotenv = "0.10.1"
chrono = "0.4"
-
fern = { version = "0.5", features = ["colored"] }
-
[dependencies.serenity]
version = "0.5"
default-features = false
diff --git a/src/main.rs b/src/main.rs
index 3f29d8e..b624d96 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -127,10 +127,17 @@ fn main() {
message
))
})
- .level(log::LevelFilter::Warn)
- .level_for("thulani_rs", log::LevelFilter::Trace)
.level_for("serenity::voice::connection", log::LevelFilter::Error)
- .chain(std::io::stdout())
+ .chain(fern::Dispatch::new()
+ .level(log::LevelFilter::Warn)
+ .level_for("thulani", log::LevelFilter::Debug)
+ .chain(std::io::stdout())
+ )
+ .chain(fern::Dispatch::new()
+ .level(log::LevelFilter::Info)
+ .level_for("thulani", log::LevelFilter::Trace)
+ .chain(fern::log_file("thulani.log").expect("problem creating log file"))
+ )
.apply()
.expect("error initializing logging");