From 2eab455252b10ed3ee4672f298109dfdcffa20cb Mon Sep 17 00:00:00 2001 From: Sebastian Rollen Date: Thu, 17 Jun 2021 23:05:00 -0400 Subject: [PATCH] better logging --- Cargo.lock | 31 +------------------------------ Cargo.toml | 4 +--- src/main.rs | 13 +++++-------- 3 files changed, 7 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b04b44..b6e0877 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,7 +46,7 @@ dependencies = [ [[package]] name = "alpaca-data-relay" -version = "1.1.2" +version = "1.1.3" dependencies = [ "alpaca", "anyhow", @@ -61,8 +61,6 @@ dependencies = [ "serde_json", "tokio 1.5.0", "tracing", - "tracing-bunyan-formatter", - "tracing-log", "tracing-subscriber", ] @@ -425,16 +423,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "gethostname" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e692e296bfac1d2533ef168d0b60ff5897b8b70a4009276834014dd8924cc028" -dependencies = [ - "libc", - "winapi 0.3.9", -] - [[package]] name = "getrandom" version = "0.1.16" @@ -1938,23 +1926,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tracing-bunyan-formatter" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce1eae70720bd6bb3944f7cf501761aeae658bd1f9293aa373c71a195064910" -dependencies = [ - "chrono", - "gethostname", - "log", - "serde 1.0.125", - "serde_json", - "tracing", - "tracing-core", - "tracing-log", - "tracing-subscriber", -] - [[package]] name = "tracing-core" version = "0.1.17" diff --git a/Cargo.toml b/Cargo.toml index 58d2582..ea81202 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "alpaca-data-relay" -version = "1.1.2" +version = "1.1.3" authors = ["Sebastian Rollen "] edition = "2018" @@ -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 } diff --git a/src/main.rs b/src/main.rs index 496d6dd..533566e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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(),