mirror of
https://github.com/lldap/lldap.git
synced 2026-07-25 17:58:44 +00:00
server: Add a way to print raw logs
If the variable LLDAP_RAW_LOG is set, the logs will be both formatted with tracing_forest and printed raw
This commit is contained in:
committed by
nitnelave
parent
dcb45d4f6b
commit
56eee6908e
@@ -3,6 +3,7 @@ use actix_web::{
|
|||||||
dev::{ServiceRequest, ServiceResponse},
|
dev::{ServiceRequest, ServiceResponse},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
use std::env;
|
||||||
use tracing::{debug, error, Span};
|
use tracing::{debug, error, Span};
|
||||||
use tracing_actix_web::RootSpanBuilder;
|
use tracing_actix_web::RootSpanBuilder;
|
||||||
use tracing_subscriber::{filter::EnvFilter, layer::SubscriberExt, util::SubscriberInitExt};
|
use tracing_subscriber::{filter::EnvFilter, layer::SubscriberExt, util::SubscriberInitExt};
|
||||||
@@ -42,10 +43,14 @@ pub fn init(config: &Configuration) -> anyhow::Result<()> {
|
|||||||
"sqlx=warn,reqwest=warn,info"
|
"sqlx=warn,reqwest=warn,info"
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
tracing_subscriber::registry()
|
let registry = tracing_subscriber::registry()
|
||||||
.with(env_filter)
|
.with(env_filter)
|
||||||
.with(tracing_forest::ForestLayer::default())
|
.with(tracing_forest::ForestLayer::default());
|
||||||
.init();
|
if env::var("LLDAP_RAW_LOG").is_ok() {
|
||||||
|
registry.with(tracing_subscriber::fmt::layer()).init();
|
||||||
|
} else {
|
||||||
|
registry.init();
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user