mt_logger
mt_logger
is a multithreaded Rust logging library focusing on traceability and ease-of-use via macros. Due to the nature of multithreading, it is best used in long-running programs with frequent or regular yields, such as web servers or game engines.
Logs are stored in a logs
directory inside the working directory from which a program using it is launched. The directory will be created if it does not already exist. Log file names follow the format
mt_log_YYYY-MM-DD_HH_MM_SS.ssss.log
At initialization, a thread is created to receive log messages and commands from the main thread. Timestamps are set before sending in order to maintain complete traceability.
Usage
The recommended method for using mt_logger
is via macros. A global log sender is created by mt_new!()
, so all further log messages and commands can be issues simply by calling the appropriate macro, such as mt_log!()
to send a log message. No passing of references to a logger instance, or cloning of an mpsc::Sender
required!
use thread;
use time;
use *;