use tracing::Level;
#[derive(Debug, Clone, Default)]
pub struct MiddlewareTracing {
pub csrf: Option<Level>,
pub csp: Option<Level>,
pub cors: Option<Level>,
pub rate_limit: Option<Level>,
pub host_validation: Option<Level>,
pub open_redirect: Option<Level>,
pub anti_bot: Option<Level>,
pub https: Option<Level>,
}
impl MiddlewareTracing {
pub fn new() -> Self {
Self::default()
}
#[must_use]
pub fn csrf(mut self, level: Level) -> Self {
self.csrf = Some(level);
self
}
#[must_use]
pub fn csp(mut self, level: Level) -> Self {
self.csp = Some(level);
self
}
#[must_use]
pub fn cors(mut self, level: Level) -> Self {
self.cors = Some(level);
self
}
#[must_use]
pub fn rate_limit(mut self, level: Level) -> Self {
self.rate_limit = Some(level);
self
}
#[must_use]
pub fn host_validation(mut self, level: Level) -> Self {
self.host_validation = Some(level);
self
}
#[must_use]
pub fn open_redirect(mut self, level: Level) -> Self {
self.open_redirect = Some(level);
self
}
#[must_use]
pub fn anti_bot(mut self, level: Level) -> Self {
self.anti_bot = Some(level);
self
}
#[must_use]
pub fn https(mut self, level: Level) -> Self {
self.https = Some(level);
self
}
pub fn dev(self) -> Self {
self.csrf(Level::DEBUG)
.csp(Level::DEBUG)
.cors(Level::DEBUG)
.rate_limit(Level::DEBUG)
.host_validation(Level::DEBUG)
.open_redirect(Level::DEBUG)
.anti_bot(Level::DEBUG)
.https(Level::DEBUG)
}
}