Commit 7a2a016a authored by Heinz N. Gies's avatar Heinz N. Gies

Add bynyan logging

parent 64d94a89
......@@ -9,6 +9,7 @@ dependencies = [
"serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"slog 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-async 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-bunyan 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-scope 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-term 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -30,6 +31,11 @@ dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bitflags"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
version = "0.8.2"
......@@ -45,6 +51,11 @@ dependencies = [
"serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cfg-if"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "chrono"
version = "0.3.1"
......@@ -144,6 +155,17 @@ name = "matches"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "nix"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num"
version = "0.1.39"
......@@ -267,6 +289,28 @@ dependencies = [
"thread_local 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "slog-bunyan"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"chrono 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"slog 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-json 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "slog-json"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"chrono 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"slog 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "slog-scope"
version = "2.0.0"
......@@ -438,8 +482,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"
"checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4"
"checksum cargo_metadata 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5d84cb53c78e573aa126a4b9f963fdb2629f8183b26e235da08bb36dc7381162"
"checksum cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c47d456a36ebf0536a6705c83c1cbbcb9255fbc1d905a6ded104f479268a29"
"checksum chrono 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d9123be86fd2a8f627836c235ecdf331fdd067ecf7ac05aa1a68fbcf2429f056"
"checksum clap 2.24.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b8f69e518f967224e628896b54e41ff6acfb4dcfefc5076325c36525dac900f"
"checksum clippy 0.0.140 (registry+https://github.com/rust-lang/crates.io-index)" = "c94943cf8c69a405dd21a0f2ce2311f1c8777a9e54422baaae2397b688d26c89"
......@@ -452,6 +498,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf"
"checksum libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)" = "38f5c2b18a287cf78b4097db62e20f43cace381dc76ae5c0a3073067f78b7ddc"
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
"checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487"
"checksum num 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "2c3a3dc9f30bf824141521b30c908a859ab190b76e20435fcd89f35eb6583887"
"checksum num-integer 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "ef1a4bf6f9174aa5783a9b4cc892cacd11aebad6c69ad027a0b65c6ca5f8aa37"
"checksum num-iter 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "f7d1891bd7b936f12349b7d1403761c8a0b85a18b148e9da4429d5d102c1a41e"
......@@ -469,6 +516,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "48b04779552e92037212c3615370f6bd57a40ebba7f20e554ff9f55e41a69a7b"
"checksum slog 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "057f354e538bfb65380f06810d2ab85933872563b20f53daa8144e5beae3aa3b"
"checksum slog-async 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afbebab3918ccc36e83dca6879dbe554fc2874d1c26e3dd5debf646a5ee60936"
"checksum slog-bunyan 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c77676c4db1c9688c4bb4fb55a86f5ef247c8d6b58dcb5b14251b466664274ea"
"checksum slog-json 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bea62d7197b99e7142a821b1cef7bd958108b48cf76a030087383643885b65e1"
"checksum slog-scope 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b719bbab7e785c9bc2790be278822e7e8d60fbe4592954774b7b41449f7524c"
"checksum slog-term 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e98b9b40c26b62acbc114bc24feb3eb080dc6c8bc78461935474ded369a3a2ee"
"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694"
......
......@@ -14,6 +14,7 @@ slog = "2"
slog-term = "2"
slog-async = "2"
slog-scope = "2"
slog-bunyan = "2"
[dependencies.clap]
version = "2"
......
......@@ -27,6 +27,7 @@ extern crate slog_term;
extern crate slog_async;
#[macro_use]
extern crate slog_scope;
extern crate slog_bunyan;
use slog::Drain;
......@@ -119,13 +120,14 @@ fn run() -> i32 {
let file = OpenOptions::new()
.create(true)
.write(true)
.truncate(true)
.append(true)
.open(log_path)
.unwrap();
// create logger
let decorator = slog_term::PlainSyncDecorator::new(file);
let file_drain = slog_term::FullFormat::new(decorator).build().fuse();
let file_drain = slog_bunyan::default(file).map(slog::Fuse);
//let file_drain = slog_term::FullFormat::new(decorator).build().fuse();
let file_drain = slog_async::Async::new(file_drain).build().fuse();
let drain = slog::Duplicate::new(file_drain, term_drain).fuse();
let root = slog::Logger::root(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment