Expand description
§RustLogs (RLG)
RustLogs (RLG) is a robust and flexible logging library for Rust applications. It provides a simple, readable output format and offers various features to enhance your application’s logging capabilities.
§Features
- Multiple log levels:
ALL
,DEBUG
,DISABLED
,ERROR
,FATAL
,INFO
,NONE
,TRACE
,VERBOSE
, andWARN
. - Structured log formats for easy parsing and filtering.
- Support for multiple output formats including:
- Common Event Format (CEF)
- Extended Log Format (ELF)
- Graylog Extended Log Format (GELF)
- JavaScript Object Notation (JSON)
- NCSA Common Log Format (CLF)
- W3C Extended Log File Format (W3C)
- Syslog Format
- Apache Access Log Format
- Logstash Format
- Log4j XML Format
- NDJSON (Newline Delimited JSON)
- Configurable logging destinations (file, stdout, network).
- Log rotation support.
- Asynchronous logging for improved performance.
Re-exports§
pub use config::Config;
pub use config::LogRotation;
pub use config::LoggingDestination;
pub use log::Log;
pub use log_format::LogFormat;
pub use log_level::LogLevel;
pub use error::RlgError;
pub use error::RlgResult;
pub use utils::generate_timestamp;
pub use utils::sanitize_log_message;
Modules§
- Configuration module for RustLogs. Configuration module for RustLogs (RLG).
- Error handling module
- Core logging functionality.
- Log format definitions and implementations.
- Log level definitions and implementations.
- Macros for convenient logging.
- Utility functions module
Macros§
- This macro conditionally logs a debug message if the
debug_enabled
feature flag is set. - This macro creates an
ERROR
level log entry with a default session ID and format. The session ID is generated randomly and the log format defaults to CLF. - This macro creates a
FATAL
level log entry with a default session ID and format. The session ID is generated randomly and the log format defaults to CLF. - This macro creates an
INFO
level log entry with a default session ID and format. The session ID is generated randomly and the log format defaults to CLF. - This macro simplifies the creation of log entries with specific parameters. It returns a new
Log
instance based on the provided session ID, time, level, component, description, and format. - This macro conditionally logs a message based on a predicate.
- This macro asynchronously logs a message to a file. It returns the result of the logging operation, which could be used to check the success or failure of the logging action.
- This macro logs with metadata. It replaces specific keys in the log message with consistent ones.
- This macro prints a log entry to the standard output (stdout). It is useful for debugging or simple logging to the console.
- This macro sets the log format to CLF if it is not already defined.
- This macro creates a
TRACE
level log entry with a default session ID and format. The session ID is generated randomly and the log format defaults to CLF. - This macro creates a
WARN
level log entry with a default session ID and format. The session ID is generated randomly and the log format defaults to CLF.
Constants§
- The current version of the RustLogs crate.