Expand description
A simple logger library. This library provides a simple log writer and simple log level control. It can be used to write logs in a program. The logs can be written to a dictionary. The log level can be set to different levels (Error, Warn, Debug, Info and Trace).
Macros§
- debug
- Macro to log debug message. First lock the logger in static, then log the message.
- error
- Macro to log error message. First lock the logger in static, then log the message.
- func
- A macro that returns the name of the function it is called in.
- info
- Macro to log info message. First lock the logger in static, then log the message.
- log
- position
- A macro that returns the current position in the code.
- trace
- Macro to log trace message. First lock the logger in static, then log the message.
- warn
- Macro to log warning message. First lock the logger in static, then log the message.
Structs§
- LOGGER
- The static logger.
If async feature is enabled, the mutex used is [
tokio::sync::mutex
], otherwise it isstd::sync::Mutex
. - Logger
- A writer for buffering the log and writing them into the suitable files.
- Setting
- the configuration of the logger.
Enums§
- LogLevel
- Enumeration of log levels. This defines the emergency of the log. (the corresponding number is used to compare the log level to decide write to the log file or not.)
Functions§
- clean_
log - Provide a easier way to clean all the existed logs.
- disable_
log - Public function to disable logging
- enable_
log - Public function to enable logging
- init
- Initialize the static logger with customized setting.