diff --git a/src/main.rs b/src/main.rs index ad12f44..9c8e783 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,13 +26,17 @@ use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Layer}; pub struct DomainRootSpanBuilder; +const DEV_MODE: bool = true; + impl RootSpanBuilder for DomainRootSpanBuilder { fn on_request_start(request: &ServiceRequest) -> Span { let method = request.method(); let info = request.connection_info(); let ip = info.realip_remote_addr().expect("hi"); let location = request.path(); - info!(?method, ip, location); + if DEV_MODE { + info!(?method, ip, location); + } tracing_actix_web::root_span!(request) // let client_id: &str = todo!("Somehow extract it from the authorization header"); @@ -49,7 +53,11 @@ async fn main() -> std::io::Result<()> { .rotation(Rotation::DAILY) .filename_prefix("api") .filename_suffix("log") - .build("/tmp/tfcsite") + .build(if DEV_MODE { + "/tmp/tfcsite" + } else { + "/storage/logs/tfcsite" + }) .expect("Shouldn't"); let filter = EnvFilter::builder() @@ -88,7 +96,11 @@ async fn main() -> std::io::Result<()> { App::new() .app_data(data.clone()) .wrap(TracingLogger::::new()) - .app_data(TempFileConfig::default().directory("/tmp/tfcsite")) + .app_data(TempFileConfig::default().directory(if DEV_MODE { + "/tmp/tfcsite" + } else { + "/storage/logs/tfcsite" + })) .service(mt_form) .service(health_form) .service(mt_parent_form)