mirror of
https://github.com/lldap/lldap.git
synced 2024-10-23 04:16:24 +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:
parent
dcb45d4f6b
commit
56eee6908e
1 changed files with 8 additions and 3 deletions
|
@ -3,6 +3,7 @@ use actix_web::{
|
|||
dev::{ServiceRequest, ServiceResponse},
|
||||
Error,
|
||||
};
|
||||
use std::env;
|
||||
use tracing::{debug, error, Span};
|
||||
use tracing_actix_web::RootSpanBuilder;
|
||||
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"
|
||||
})
|
||||
});
|
||||
tracing_subscriber::registry()
|
||||
let registry = tracing_subscriber::registry()
|
||||
.with(env_filter)
|
||||
.with(tracing_forest::ForestLayer::default())
|
||||
.init();
|
||||
.with(tracing_forest::ForestLayer::default());
|
||||
if env::var("LLDAP_RAW_LOG").is_ok() {
|
||||
registry.with(tracing_subscriber::fmt::layer()).init();
|
||||
} else {
|
||||
registry.init();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue