Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Logforth
Logforth is a flexible and easy-to-use logging framework for Rust applications. It allows you to configure multiple dispatches, filters, and appenders to customize your logging setup according to your needs.
Features
- Multiple Dispatches: Configure different logging behaviors for different parts of your application.
- Flexible Filters: Use built-in or custom filters to control which log records are processed.
- Various Appenders: Output logs to stdout, stderr, files, or even send them to OpenTelemetry collectors.
- Elegant Layouts: Format log records using predefined layouts or create your own.
- Enrichable Diagnostics: Attach additional context to log records for better debugging and analysis.
- Custom Components: Easily implement your own appenders, filters, layouts, and diagnostics by implementing the provided traits.
- Bridges: Out-of-the-box integration with the
log
crate for seamless logging.
Getting Started
Add log
and logforth
to your Cargo.toml
:
cargo add log
cargo add logforth -F starter-log
Simple Usage
Set up a basic logger that outputs to stdout:
By default, all logging except the error level is disabled. You can enable logging at other levels by setting the RUST_LOG
environment variable. For example, RUST_LOG=debug cargo run
will print all logs.
Advanced Usage
Configure multiple dispatches with different filters and appenders:
use append;
use LevelFilter;
Read more demos under the examples directory.
Documentation
Read the online documents at https://docs.rs/logforth.
Components are organized into several crates:
- Core APIs:
logforth-core
- Built-in appenders:
Stdout
,Stderr
,Testing
- Built-in filters:
EnvFilter
- Built-in layouts:
PlainTextLayout
- Built-in diagnostics:
StaticDiagnostic
,ThreadLocalDiagnostic
- Built-in appenders:
- Appenders:
logforth-append-*
- Layouts:
logforth-layout-*
- Diagnostics:
logforth-diagnostic-*
- Bridges:
logforth-bridge-*
Minimum Rust version policy
This crate is built against the latest stable release, and its minimum supported rustc version is 1.85.0.
The policy is that the minimum Rust version required to use this crate can be increased in minor version updates. For example, if Logforth 1.0 requires Rust 1.60.0, then Logforth 1.0.z for all values of z will also require Rust 1.60.0 or newer. However, Logforth 1.y for y > 0 may require a newer minimum version of Rust.
Maturity
This crate has been in development since 2024-08. It is being used in several production systems stable enough to be considered mature, but it is still evolving.
All modular components are factored out into separate crates. We are working to stabilize the core APIs and several core components, and then release them as logforth-core
1.0. Other components will be released as separate crates that depend on logforth-core
.
License and Origin
This project is licensed under Apache License, Version 2.0.
The name Logforth
comes from an antonym of the Logback
project, and may also be read as a homophone of "log force".