Skip to content

Commit

Permalink
made sure that tracing and sentry play ball
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Jul 1, 2024
1 parent 278cee3 commit 85a1b82
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions server/Cargo.lock

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

2 changes: 1 addition & 1 deletion server/main-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ path = "src/main.rs"
actix-web-prom = { version = "0.8.0", default-features = false, features = [] }
tracing-subscriber = { version = "0.3.18",features = ["env-filter", "json", "fmt"]}
tracing = "0.1.40"
sentry = { version = "0.34.0", features = ["backtrace","contexts","debug-images","panic","reqwest","rustls"] }
sentry = { version = "0.34.0", features = ["tracing","metrics","backtrace","contexts","debug-images","panic","reqwest","rustls"] }
sentry-actix = "0.34.0"

#serialisation
Expand Down
3 changes: 2 additions & 1 deletion server/main-api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use sqlx::postgres::PgPoolOptions;
use sqlx::prelude::*;
use sqlx::PgPool;
use tracing::{debug, error, info};
use tracing_subscriber::fmt::Layer;

mod calendar;
mod details;
Expand Down Expand Up @@ -60,6 +59,7 @@ fn connection_string() -> String {

pub fn setup_logging() {
use tracing_subscriber::filter::EnvFilter;
use tracing_subscriber::fmt::Layer;
use tracing_subscriber::prelude::*;
let default_level = if cfg!(any(debug_assertions, test)) {
"debug"
Expand All @@ -74,6 +74,7 @@ pub fn setup_logging() {

let registry = tracing_subscriber::registry()
.with(filter)
.with(sentry::integrations::tracing::layer())
.with(cfg!(not(any(debug_assertions, test))).then(|| Layer::default().json()))
.with(cfg!(any(debug_assertions, test)).then(|| Layer::default().pretty()));
tracing::subscriber::set_global_default(registry).unwrap();
Expand Down

0 comments on commit 85a1b82

Please sign in to comment.