Skip to main content

Crate prologger

Crate prologger 

Source
Expand description

§Prologger

A production-grade, ergonomic Rust logging library with colored output, file rotation, and structured formatting.

Prologger implements the log crate facade, so you can use the standard log::info!(), log::warn!(), etc. macros throughout your codebase.

§Quick Start

use log::{info, warn, error, debug};

fn main() {
    // Initialize with sensible defaults (colored console output at Info level)
    prologger::init();

    info!("Application started");
    debug!("This won't show at Info level");
    warn!("Low disk space");
    error!("Connection failed");
}

§Builder API

For fine-grained control, use the builder:

use log::LevelFilter;
use prologger::ProLoggerBuilder;

ProLoggerBuilder::new()
    .with_level(LevelFilter::Debug)
    .with_console_default()
    .with_module_filter("hyper", LevelFilter::Warn)
    .init()
    .unwrap();

§Features

FeatureDefaultDescription
colorANSI colored terminal output
fileFile logging with size-based rotation
jsonJSON structured output formatter
fullEnables all features

Re-exports§

pub use builder::ProLoggerBuilder;
pub use color::ColorMode;
pub use env::EnvConfig;
pub use env::EnvParseError;
pub use formatter::FormatterType;
pub use logger::ProLogger;
pub use rotation::RotationConfig;
pub use log;

Modules§

builder
Builder pattern for constructing a configured ProLogger.
color
ANSI color support for terminal output.
env
Environment variable configuration for prologger.
filter
Log filtering engine with global and per-module level overrides.
formatter
Log record formatters.
logger
Core logger implementation.
rotation
File rotation logic for size-based log file rotation.
sink
Log output sinks.

Enums§

Level
An enum representing the available verbosity levels of the logger.
LevelFilter
An enum representing the available verbosity level filters of the logger.

Functions§

init
Initializes prologger with sensible defaults.
init_from_env
Initializes prologger using the RUST_LOG environment variable.
init_with_level
Initializes prologger with the given maximum log level.
try_init
Tries to initialize prologger with sensible defaults.
try_init_from_env
Tries to initialize prologger using the RUST_LOG environment variable.
try_init_with_level
Tries to initialize prologger with the given maximum log level.