Skip to main content

enable_logger

Macro enable_logger 

Source
macro_rules! enable_logger {
    () => { ... };
}
Expand description

Installs the SDK logger with defaults derived from the caller’s Cargo.toml. Writes to logs/{CARGO_PKG_NAME}.log with size-based rotation (50 MB × 5 archives) and forwards every line to the server’s own log prefixed with [CARGO_PKG_NAME].

Returns Result<(), samp::logger::InstallError> — the most common failures are “already installed” (a second call in the same process) and “I/O” (the log directory could not be created).

§Example

fn on_load(&mut self) {
    let _ = samp::enable_logger!();
    log::info!("ready");
}