plog

Function plog 

Source
pub fn plog(level: LogLevel, message: &str)
Expand description

Log a message at the specified level.

This function provides a Python vanguards-compatible logging interface. It maps log levels to tracing macros.

§Arguments

  • level - The log level for this message
  • message - The message to log

§Level Mapping

LogLeveltracing macro
Debugdebug!
Infoinfo!
Noticeinfo!
Warnwarn!
Errorerror!

§Example

use vanguards_rs::{LogLevel, logger};

logger::plog(LogLevel::Notice, "Vanguards started");
logger::plog(LogLevel::Warn, "Connection lost, retrying...");
logger::plog(LogLevel::Error, "Failed to connect to Tor");

§Notes

  • Messages are only output if the level meets the configured minimum
  • Notice maps to info! since tracing doesn’t have a notice level

§See Also

  • init - Initialize logging before calling plog
  • plog_fmt - Formatted logging macro