mirror of
https://github.com/flibusta-apps/library_updater.git
synced 2025-12-06 07:45:35 +01:00
Fix
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -841,6 +841,7 @@ dependencies = [
|
||||
"maplit",
|
||||
"reqwest",
|
||||
"sentry",
|
||||
"sentry-tracing",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sql-parse",
|
||||
|
||||
@@ -27,5 +27,7 @@ maplit = "1.0.2"
|
||||
|
||||
tracing = "0.1.40"
|
||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"]}
|
||||
sentry-tracing = "0.32.3"
|
||||
|
||||
tower-http = { version = "0.5.2", features = ["trace"] }
|
||||
dotenv = "0.15.0"
|
||||
|
||||
20
src/main.rs
20
src/main.rs
@@ -9,10 +9,14 @@ pub mod utils;
|
||||
use axum::{http::HeaderMap, routing::post, Router};
|
||||
use dotenv::dotenv;
|
||||
use sentry::{integrations::debug_images::DebugImagesIntegration, types::Dsn, ClientOptions};
|
||||
use sentry_tracing::EventFilter;
|
||||
use std::{net::SocketAddr, str::FromStr};
|
||||
use tower_http::trace::{self, TraceLayer};
|
||||
use tracing::log;
|
||||
use tracing::Level;
|
||||
use tracing_subscriber::filter;
|
||||
use tracing_subscriber::layer::SubscriberExt;
|
||||
use tracing_subscriber::util::SubscriberInitExt;
|
||||
|
||||
use crate::updater::cron_jobs;
|
||||
|
||||
@@ -57,11 +61,6 @@ async fn start_app() {
|
||||
async fn main() {
|
||||
dotenv().ok();
|
||||
|
||||
tracing_subscriber::fmt()
|
||||
.with_target(false)
|
||||
.compact()
|
||||
.init();
|
||||
|
||||
let options = ClientOptions {
|
||||
dsn: Some(Dsn::from_str(&config::CONFIG.sentry_dsn).unwrap()),
|
||||
default_integrations: false,
|
||||
@@ -71,5 +70,16 @@ async fn main() {
|
||||
|
||||
let _guard = sentry::init(options);
|
||||
|
||||
let sentry_layer = sentry_tracing::layer().event_filter(|md| match md.level() {
|
||||
&tracing::Level::ERROR => EventFilter::Event,
|
||||
_ => EventFilter::Ignore,
|
||||
});
|
||||
|
||||
tracing_subscriber::registry()
|
||||
.with(tracing_subscriber::fmt::layer().with_target(false))
|
||||
.with(filter::LevelFilter::INFO)
|
||||
.with(sentry_layer)
|
||||
.init();
|
||||
|
||||
tokio::join![cron_jobs(), start_app()];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user