Skip to content

Commit

Permalink
init tracing so that I can enable debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
CircuitSacul committed Sep 18, 2023
1 parent 0090251 commit 07ca82b
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 3 deletions.
87 changes: 84 additions & 3 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ psutil = "3.2.2"
rust-fuzzy-search = "0.1.1"
moka = { version = "0.11.2", features = ["future"] }
cached = "0.44.0"
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
12 changes: 12 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,23 @@ pub mod utils;

use snafu::ErrorCompat;
use tokio::main;
use tracing_subscriber::{fmt, EnvFilter};

use crate::client::{bot::StarboardBot, config::Config, runner::run};

fn init_tracing() {
tracing::subscriber::set_global_default(
fmt::Subscriber::builder()
.with_env_filter(EnvFilter::from_default_env())
.finish(),
)
.expect("Unable to set global tracing subscriber");
}

#[main]
async fn main() {
init_tracing();

let config = Config::from_env();

let _sentry_guard = config.sentry.as_ref().map(|url| {
Expand Down

0 comments on commit 07ca82b

Please sign in to comment.