Crate zlogger

Crate zlogger 

Source
Expand description

§zlogger

§Features

  • Color-coded log levels for terminal output
  • Environment variable configuration
  • File logging with automatic rotation
  • Multiple output targets (console, file, or both)
  • Customizable log formats
  • Thread-safe logging

§Quick Start

use colorful_logger::{init, info, warn, error};
 
// Initialize with default settings
init();
 
// Log messages
info!("Application started");
warn!("This is a warning");
error!("Something went wrong");

§Environment Variables

  • ZLOG_LEVEL: Set log level (trace, debug, info, warn, error)
  • ZLOG_OUTPUT: Set output target (console, file, both)
  • ZLOG_FILE: Set log file path
  • ZLOG_MAX_SIZE: Set max file size before rotation (in bytes)
  • ZLOG_MAX_FILES: Set maximum number of rotated files to keep
  • ZLOG_COLOR: Enable/disable colors (true/false)

Re-exports§

pub use logger::Logger;
pub use config::Config;
pub use config::LogLevel;
pub use config::OutputTarget;

Modules§

colors
config
formatter
logger
rotation

Macros§

debug
Log a debug message
error
Log an error message
info
Log an info message
trace
Log a trace message
warn
Log a warning message

Functions§

init
Initialize the global logger with default configuration
init_with_config
Initialize the global logger with custom configuration