use crate::cache::SharedCache;
use crate::security::AuditLog;
use std::sync::Arc;
mod audit_impl;
pub(crate) use audit_impl::{sanitize_error_message, JWT_PATTERN, SECRET_PATTERN, PATH_PATTERN};
pub(crate) struct AuditLogBatch {
user_id: String,
#[allow(dead_code)] log: AuditLog,
}
#[derive(Clone)]
pub struct AppAuditLogger {
logs: SharedCache,
max_logs_per_user: usize,
semaphore: Arc<tokio::sync::Semaphore>,
queue_sender: Arc<tokio::sync::mpsc::Sender<AuditLogBatch>>,
fallback_logs: SharedCache,
dropped_log_count: Arc<std::sync::atomic::AtomicU64>,
total_log_count: Arc<std::sync::atomic::AtomicU64>,
}
pub struct AppAuditLoggerBuilder {
max_logs_per_user: usize,
max_concurrent_ops: usize,
queue_size: usize,
}
#[cfg(test)]
mod tests;