Crate logforth

Source
Expand description

Logforth is a flexible logging framework for Rust applications, providing easy log dispatching and configuration.

§Overview

Logforth allows you to set up multiple log dispatches with different filters and appenders. You can configure global log levels, use built-in appenders for stdout, stderr, files, or create custom appenders. It integrates seamlessly with the log crate.

§Examples

Simple setup with default stdout appender:

logforth::stdout().apply();

log::info!("This is an info message.");

Advanced setup with custom filters and multiple appenders:

use log::LevelFilter;
use logforth::append;

logforth::builder()
    .dispatch(|d| {
        d.filter(LevelFilter::Error)
            .append(append::Stderr::default())
    })
    .dispatch(|d| {
        d.filter(LevelFilter::Info)
            .append(append::Stdout::default())
    })
    .apply();

log::error!("Error message.");
log::info!("Info message.");

Re-exports§

Modules§

Structs§

  • A builder for configuring log dispatching and setting up the global logger.
  • A builder for configuring a log dispatch, including filters and appenders.

Functions§