pub struct AuditLogger { /* private fields */ }Expand description
The main audit logger.
Implementations§
Source§impl AuditLogger
impl AuditLogger
Sourcepub fn new() -> AuditLogger
pub fn new() -> AuditLogger
Create a new audit logger with no handlers.
Sourcepub fn with_stdout() -> AuditLogger
pub fn with_stdout() -> AuditLogger
Create an audit logger with stdout logging.
Sourcepub fn add_handler<H>(self, handler: H) -> AuditLoggerwhere
H: SecurityEventHandler + 'static,
pub fn add_handler<H>(self, handler: H) -> AuditLoggerwhere
H: SecurityEventHandler + 'static,
Add an event handler.
Sourcepub fn with_handler<F>(self, handler: F) -> AuditLogger
pub fn with_handler<F>(self, handler: F) -> AuditLogger
Add a closure as event handler.
Sourcepub fn enabled(self, enabled: bool) -> AuditLogger
pub fn enabled(self, enabled: bool) -> AuditLogger
Enable or disable the logger.
Sourcepub fn log(&self, event: SecurityEvent)
pub fn log(&self, event: SecurityEvent)
Log a security event.
Sourcepub fn log_login_success(&self, username: &str, ip: &str)
pub fn log_login_success(&self, username: &str, ip: &str)
Log a login success event.
Sourcepub fn log_login_failure(&self, username: &str, ip: &str, reason: &str)
pub fn log_login_failure(&self, username: &str, ip: &str, reason: &str)
Log a login failure event.
Sourcepub fn log_access_denied(&self, username: &str, path: &str, ip: &str)
pub fn log_access_denied(&self, username: &str, path: &str, ip: &str)
Log an access denied event.
Sourcepub fn log_rate_limit_exceeded(&self, ip: &str, path: &str)
pub fn log_rate_limit_exceeded(&self, ip: &str, path: &str)
Log a rate limit exceeded event.
Trait Implementations§
Source§impl Clone for AuditLogger
impl Clone for AuditLogger
Source§fn clone(&self) -> AuditLogger
fn clone(&self) -> AuditLogger
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for AuditLogger
impl Default for AuditLogger
Source§fn default() -> AuditLogger
fn default() -> AuditLogger
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AuditLogger
impl !RefUnwindSafe for AuditLogger
impl Send for AuditLogger
impl Sync for AuditLogger
impl Unpin for AuditLogger
impl !UnwindSafe for AuditLogger
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more