pub trait LoggerPlugin:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> String;
fn log_string(&self, message: &str) -> Result<(), String>;
// Provided methods
fn log_status(&self, status: &LogStatus) -> Result<(), String> { ... }
fn log_snapshot(&self, snapshot: &str) -> Result<(), String> { ... }
fn init(&self, _name: &str) -> Result<(), String> { ... }
fn health(&self) -> Result<(), String> { ... }
fn shutdown(&self) { ... }
}
Expand description
Trait that logger plugins must implement.
§Example
use osquery_rust_ng::plugin::{LoggerPlugin, LogStatus, LogSeverity};
struct MyLogger;
impl LoggerPlugin for MyLogger {
fn name(&self) -> String {
"my_logger".to_string()
}
fn log_string(&self, message: &str) -> Result<(), String> {
println!("Log: {}", message);
Ok(())
}
}
Required Methods§
Provided Methods§
Sourcefn log_status(&self, status: &LogStatus) -> Result<(), String>
fn log_status(&self, status: &LogStatus) -> Result<(), String>
Log structured status information.
Called when osquery sends status logs with severity, file, line, and message.
Sourcefn log_snapshot(&self, snapshot: &str) -> Result<(), String>
fn log_snapshot(&self, snapshot: &str) -> Result<(), String>
Log a snapshot (periodic state dump).
Snapshots are periodic dumps of osquery’s internal state.
Sourcefn init(&self, _name: &str) -> Result<(), String>
fn init(&self, _name: &str) -> Result<(), String>
Initialize the logger.
Called when the logger is first registered with osquery.