2 releases

0.1.1 Jul 6, 2024
0.1.0 Jul 6, 2024

#296 in Debugging

MIT/Apache

355KB
5.5K SLoC

Rust 4.5K SLoC // 0.1% comments INI 770 SLoC // 0.7% comments

MDLOGGER

Rust lib: Multi-device logger

This library crate implements a logging system that is able to log message on different devices at same time.
Each device is managed by an object that implements LogHandler trait.
There are 4 predefined log handler:

  • Console
  • Rolling file
  • Network socket (udp, tcp, multicat)
  • Unix domain socket (udp, tcp Windows OS tcp only)

These predefined log handler are registered in the initialize function.
You can implement your own handler and register it [see register_log_handler_factory funtion in the documentation] before call the initialize function.
The logger is configured using a text file with a classic .ini syntax

Logging message can be identify by a category (a free text tag that could be print out with in log message) and a type, there are 5 type of messages:

  1. Debug
  2. Info
  3. Warning
  4. Critical
  5. Fatal

MDLogger can receive external command to change configuration at run time.

configuration file documntation

external command documentation

HOW MDLOGGER WORKS

To prevent a multi-threaded process from being slowed down as little as possible by log messaging, mdlogger creates its own logging thread where log messages are handled by different log hanlers created via the configuration file. The log function (and the related macros) do nothing more than insert the messages into a queue and then release control to the application process as quickly as possible. The queued messages will be dequeued by the log thread which will pass them to each log handler that will format them according to the configuration chosen for that handler which will then carry out its log function

This software is under [MIT OR Apache-2.0]
https://mit-license.org/
https://www.apache.org/licenses/LICENSE-2.0

MSRV 1.76.0

History

Rev. 0.1.0 First issue
Rev. 0.1.1 Correct configuration documentation

Dependencies

~4–13MB
~151K SLoC