Skip to content

Commit

Permalink
Merge pull request #28 from Overmuse/SR/json_log_format
Browse files Browse the repository at this point in the history
emit logs in json
  • Loading branch information
SebRollen authored Jun 16, 2021
2 parents 763f070 + 5db0e60 commit a97fa4b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
30 changes: 29 additions & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polygon-data-relay"
version = "1.2.3"
version = "1.2.4"
authors = ["Sebastian Rollen <[email protected]>"]
edition = "2018"

Expand All @@ -24,3 +24,4 @@ tokio = {version = "1.2", features = ["macros", "rt-multi-thread"]}
tracing = "0.1"
tracing-log = "0.1"
tracing-subscriber = "0.2"
tracing-bunyan-formatter = { version = "0.2.4", default-features = false }
10 changes: 6 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ use sentry_anyhow::capture_anyhow;
use std::sync::mpsc::channel;
use std::thread;
use tracing::{debug, info, subscriber::set_global_default};
use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer};
use tracing_log::LogTracer;
use tracing_subscriber::{filter::EnvFilter, FmtSubscriber};
use tracing_subscriber::{layer::SubscriberExt, Registry};

fn main() -> Result<()> {
let _ = dotenv();
let subscriber = FmtSubscriber::builder()
.with_env_filter(EnvFilter::from_default_env())
.finish();
let formatting_layer = BunyanFormattingLayer::new("polygon-data-relay".into(), std::io::stdout);
let subscriber = Registry::default()
.with(JsonStorageLayer)
.with(formatting_layer);
set_global_default(subscriber).expect("Failed to set subscriber");
LogTracer::init().expect("Failed to set logger");
let settings = Settings::new()?;
Expand Down

0 comments on commit a97fa4b

Please sign in to comment.