Skip to content

Commit

Permalink
better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
SebRollen committed Jun 18, 2021
1 parent d4e18cb commit fc5613f
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 = "trader"
version = "1.0.2"
version = "1.0.3"
authors = ["RollenRegistratorBot <[email protected]>"]
edition = "2018"

Expand All @@ -18,8 +18,6 @@ serde = "1.0.116"
serde_json = "1.0.57"
tokio = { version = "1.2", features = ["macros", "rt-multi-thread"] }
tracing = "0.1"
tracing-bunyan-formatter = { version = "0.2.4", default-features = false }
tracing-log = "0.1"
tracing-subscriber = "0.2"
uuid = "0.8.1"

Expand Down
13 changes: 5 additions & 8 deletions src/telemetry.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
use tracing::subscriber::{set_global_default, Subscriber};
use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer};
use tracing_log::LogTracer;
use tracing_subscriber::{layer::SubscriberExt, Registry};
use tracing_subscriber::EnvFilter;

pub fn get_subscriber() -> impl Subscriber + Send + Sync {
let formatting_layer = BunyanFormattingLayer::new("polygon-data-relay".into(), std::io::stdout);
Registry::default()
.with(JsonStorageLayer)
.with(formatting_layer)
tracing_subscriber::fmt()
.json()
.with_env_filter(EnvFilter::from_default_env())
.finish()
}

pub fn init_subscriber(subscriber: impl Subscriber + Send + Sync) {
LogTracer::init().expect("Failed to set logger");
set_global_default(subscriber).expect("Failed to set subscriber");
}

0 comments on commit fc5613f

Please sign in to comment.