pub struct RotatingAuditor { /* private fields */ }Expand description
带轮转策略和审计规则的增强审计器。
在 SqlAuditor 基础上增加:
- 日志轮转(按大小/时间自动清理旧日志)
- 审计规则(允许/拒绝列表过滤)
Implementations§
Source§impl RotatingAuditor
impl RotatingAuditor
pub fn new(policy: RotationPolicy, rules: AuditRules) -> Self
Sourcepub fn with_max_entries(max_entries: usize) -> Self
pub fn with_max_entries(max_entries: usize) -> Self
创建仅按大小轮转的审计器,无规则过滤
Sourcepub fn with_max_age(max_age_ms: i64) -> Self
pub fn with_max_age(max_age_ms: i64) -> Self
创建仅按时间轮转的审计器,无规则过滤
Sourcepub fn log(&self, ctx: &SqlAuditContext) -> bool
pub fn log(&self, ctx: &SqlAuditContext) -> bool
记录审计日志,自动应用规则过滤和轮转策略
Sourcepub fn get_logs(&self) -> Vec<SqlAuditContext>
pub fn get_logs(&self) -> Vec<SqlAuditContext>
返回当前日志快照
Sourcepub fn rotation_count(&self) -> usize
pub fn rotation_count(&self) -> usize
返回已轮转次数
Auto Trait Implementations§
impl !Freeze for RotatingAuditor
impl RefUnwindSafe for RotatingAuditor
impl Send for RotatingAuditor
impl Sync for RotatingAuditor
impl Unpin for RotatingAuditor
impl UnsafeUnpin for RotatingAuditor
impl UnwindSafe for RotatingAuditor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more