Skip to content

Commit

Permalink
Merge pull request #6 from Overmuse/SR/log
Browse files Browse the repository at this point in the history
better logging
  • Loading branch information
SebRollen authored Jun 18, 2021
2 parents 7a6e9c8 + 815ecce commit bc1cd5a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 42 deletions.
32 changes: 1 addition & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tca"
version = "1.0.1"
version = "1.0.2"
authors = ["Sebastian Rollen <[email protected]>"]
edition = "2018"

Expand All @@ -19,9 +19,7 @@ serde = { version = "1.0.125", features = ["derive"] }
stream-processor = { git = "ssh://[email protected]/Overmuse/stream-processor", tag = "v0.2.1" }
tokio = { version = "1.4.0", features = ["macros", "rt-multi-thread"] }
tracing = "0.1.25"
tracing-log = "0.1.2"
tracing-subscriber = "0.2.17"
tracing-bunyan-formatter = { version = "0.2.4", default-features = false }
uuid = "0.8.2"

[dev-dependencies]
Expand Down
13 changes: 5 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
use anyhow::Result;
use tca::{run, Settings};
use tracing::subscriber::set_global_default;
use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer};
use tracing_log::LogTracer;
use tracing_subscriber::{layer::SubscriberExt, Registry};
use tracing_subscriber::EnvFilter;

#[tokio::main]
async fn main() -> Result<()> {
let _ = dotenv::dotenv();
let formatting_layer = BunyanFormattingLayer::new("tca".into(), std::io::stdout);
let subscriber = Registry::default()
.with(JsonStorageLayer)
.with(formatting_layer);
let subscriber = tracing_subscriber::fmt()
.json()
.with_env_filter(EnvFilter::from_default_env())
.finish();
set_global_default(subscriber).expect("Failed to set subscriber");
LogTracer::init().expect("Failed to set logger");
let settings = Settings::new()?;
run(settings).await
}

0 comments on commit bc1cd5a

Please sign in to comment.