use crate::comm::ExecuteContext;
use crate::errors::{AkitaError, Result};
use crate::interceptor::shared::InterceptorBase;
use crate::interceptor::{InterceptorType, LogLevel, OperationType};
use crate::prelude::ExecuteResult;
pub struct LoggingInterceptor {
pub slow_query_threshold_ms: u64,
}
impl LoggingInterceptor {
pub fn new() -> Self {
Self {
slow_query_threshold_ms: 1000,
}
}
pub fn with_slow_query_threshold(mut self, threshold_ms: u64) -> Self {
self.slow_query_threshold_ms = threshold_ms;
self
}
}
impl Default for LoggingInterceptor {
fn default() -> Self {
Self::new()
}
}
impl InterceptorBase for LoggingInterceptor {
fn name(&self) -> &'static str {
"logging"
}
fn interceptor_type(&self) -> InterceptorType {
InterceptorType::Logging
}
fn order(&self) -> i32 {
90
}
fn supports_operation(&self, _operation: &OperationType) -> bool {
true
}
fn will_ignore_table(&self, _table_name: &str) -> bool {
false
}
}