relocate tracing code
This commit is contained in:
parent
d4ef460321
commit
d290ccf8d0
2 changed files with 13 additions and 8 deletions
10
src/main.rs
10
src/main.rs
|
@ -1,6 +1,7 @@
|
|||
mod api;
|
||||
mod management;
|
||||
mod sse_handler;
|
||||
mod tracing_handler;
|
||||
|
||||
use cm_lib::{
|
||||
hx_request::HxRequest,
|
||||
|
@ -31,7 +32,6 @@ use diesel_async::{
|
|||
use dotenvy::dotenv;
|
||||
use std::{net::SocketAddr, time::Duration};
|
||||
use tower_http::services::{ServeDir, ServeFile};
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
use crate::templates::*;
|
||||
|
||||
|
@ -66,13 +66,7 @@ impl AppState {
|
|||
#[tokio::main]
|
||||
async fn main() {
|
||||
// initialize tracing
|
||||
tracing_subscriber::registry()
|
||||
.with(
|
||||
tracing_subscriber::EnvFilter::try_from_default_env()
|
||||
.unwrap_or_else(|_| "clubmanager=debug,tower_http=debug".into()),
|
||||
)
|
||||
.with(tracing_subscriber::fmt::layer())
|
||||
.init();
|
||||
tracing_handler::init_tracing();
|
||||
|
||||
let state = AppState::init();
|
||||
|
||||
|
|
11
src/tracing_handler.rs
Normal file
11
src/tracing_handler.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
pub fn init_tracing() {
|
||||
tracing_subscriber::registry()
|
||||
.with(
|
||||
tracing_subscriber::EnvFilter::try_from_default_env()
|
||||
.unwrap_or_else(|_| "clubmanager=debug,tower_http=debug".into()),
|
||||
)
|
||||
.with(tracing_subscriber::fmt::layer())
|
||||
.init();
|
||||
}
|
Loading…
Reference in a new issue