mirror of
https://github.com/flibusta-apps/library_updater.git
synced 2025-12-06 15:45:36 +01:00
Update logs
This commit is contained in:
17
src/main.rs
17
src/main.rs
@@ -9,9 +9,13 @@ pub mod updater;
|
||||
use std::{net::SocketAddr, str::FromStr};
|
||||
use axum::{Router, routing::post, http::HeaderMap};
|
||||
use sentry::{ClientOptions, types::Dsn, integrations::debug_images::DebugImagesIntegration};
|
||||
use tracing::log;
|
||||
use tower_http::trace::{TraceLayer, self};
|
||||
use tracing::Level;
|
||||
|
||||
use crate::updater::cron_jobs;
|
||||
|
||||
|
||||
async fn update(headers: HeaderMap) -> &'static str {
|
||||
let config_api_key = config::CONFIG.api_key.clone();
|
||||
|
||||
@@ -34,9 +38,15 @@ async fn update(headers: HeaderMap) -> &'static str {
|
||||
"Update started"
|
||||
}
|
||||
|
||||
|
||||
async fn start_app() {
|
||||
let app = Router::new()
|
||||
.route("/update", post(update));
|
||||
.route("/update", post(update))
|
||||
.layer(
|
||||
TraceLayer::new_for_http()
|
||||
.make_span_with(trace::DefaultMakeSpan::new().level(Level::INFO))
|
||||
.on_response(trace::DefaultOnResponse::new().level(Level::INFO)),
|
||||
);
|
||||
|
||||
let addr = SocketAddr::from(([0, 0, 0, 0], 8080));
|
||||
|
||||
@@ -50,7 +60,10 @@ async fn start_app() {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
env_logger::init();
|
||||
tracing_subscriber::fmt()
|
||||
.with_target(false)
|
||||
.compact()
|
||||
.init();
|
||||
|
||||
let options = ClientOptions {
|
||||
dsn: Some(Dsn::from_str(&config::CONFIG.sentry_dsn).unwrap()),
|
||||
|
||||
@@ -12,6 +12,7 @@ use tokio::fs::{File, remove_file};
|
||||
use tokio::sync::Mutex;
|
||||
use tokio_cron_scheduler::{JobScheduler, Job};
|
||||
use tokio_postgres::NoTls;
|
||||
use tracing::log;
|
||||
|
||||
use async_compression::futures::bufread::GzipDecoder;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user