Skip to content

Commit

Permalink
Merge pull request #19 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 21b1c0a + 2eab455 commit d8dca48
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 41 deletions.
31 changes: 1 addition & 30 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 = "alpaca-data-relay"
version = "1.1.2"
version = "1.1.3"
authors = ["Sebastian Rollen <[email protected]>"]
edition = "2018"

Expand All @@ -21,5 +21,3 @@ serde_json = "1.0"
tokio = {version = "1.0", features = ["macros", "rt-multi-thread"]}
tracing = "0.1.25"
tracing-subscriber = "0.2.17"
tracing-log = "0.1.2"
tracing-bunyan-formatter = { version = "0.2.4", default-features = false }
13 changes: 5 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@ use anyhow::Result;
use dotenv::dotenv;
use sentry_anyhow::capture_anyhow;
use tracing::{info, 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();
let formatting_layer = BunyanFormattingLayer::new("alpaca-data-relay".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()?;
let _guard = sentry::init((
settings.sentry.address.clone(),
Expand Down

0 comments on commit d8dca48

Please sign in to comment.