mirror of
https://github.com/NLnetLabs/krill.git
synced 2026-09-27 20:04:52 +02:00
Change HTTP Log to debug, unless KRILL_HTTP_LOG_INFO is set. (#513)
This commit is contained in:
@@ -21,6 +21,7 @@ pub const KRILL_ENV_LOG_LEVEL: &str = "KRILL_LOG_LEVEL";
|
||||
pub const KRILL_ENV_ADMIN_TOKEN: &str = "KRILL_ADMIN_TOKEN";
|
||||
pub const KRILL_ENV_ADMIN_TOKEN_DEPRECATED: &str = "KRILL_AUTH_TOKEN";
|
||||
pub const KRILL_ENV_SERVER_PORT: &str = "KRILL_SERVER_PORT";
|
||||
pub const KRILL_ENV_HTTP_LOG_INFO: &str = "KRILL_HTTP_LOG_INFO";
|
||||
|
||||
pub fn enable_test_mode() {
|
||||
std::env::set_var(KRILL_ENV_TEST, "1");
|
||||
|
||||
@@ -21,10 +21,10 @@ use hyper::server::conn::AddrIncoming;
|
||||
use hyper::service::{make_service_fn, service_fn};
|
||||
use hyper::Method;
|
||||
|
||||
use crate::commons::api::{
|
||||
use crate::{commons::api::{
|
||||
BgpStats, ChildHandle, CommandHistoryCriteria, Handle, ParentCaContact, ParentHandle, PublisherList,
|
||||
RoaDefinitionUpdates, RtaName, Token,
|
||||
};
|
||||
}, constants::KRILL_ENV_HTTP_LOG_INFO};
|
||||
use crate::commons::api::{ParentCaReq, RepositoryContact};
|
||||
use crate::commons::bgp::BgpAnalysisAdvice;
|
||||
use crate::commons::error::Error;
|
||||
@@ -176,8 +176,12 @@ impl RequestLogger {
|
||||
_ => {}
|
||||
}
|
||||
|
||||
info!("{} {} {}", self.req_method, self.req_path, response.status());
|
||||
|
||||
if env::var(KRILL_ENV_HTTP_LOG_INFO).is_ok() {
|
||||
info!("{} {} {}", self.req_method, self.req_path, response.status());
|
||||
} else {
|
||||
debug!("{} {} {}", self.req_method, self.req_path, response.status());
|
||||
}
|
||||
|
||||
if response.loggable() && log_enabled!(log::Level::Trace) {
|
||||
trace!("Response: headers={:?} body={:?}", response.headers(), response.body());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user