trillium-logger 0.5.2

logger for trillium.rs
Documentation

📝 trillium-logger — request/response logging

ci crates.io version docs.rs

Structured request/response logging for trillium. The default formatter (dev_formatter) produces concise colorized output suitable for development. Built-in apache_common and apache_combined formatters are available for production use, and custom formatters can be composed from the components in the formatters module.

Example

use trillium_logger::{Logger, apache_combined, formatters};

// default dev formatter — colorized, concise
let app = (Logger::new(), "hello");

// apache combined log format
let app = (
    Logger::new().with_formatter(apache_combined("-", "-")),
    "hello",
);

// compose a custom format from components
let app = (
    Logger::new().with_formatter((
        formatters::method,
        " ",
        formatters::url,
        " -> ",
        formatters::status,
    )),
    "hello",
);
// run with your chosen runtime adapter, e.g.:
// trillium_tokio::run(app);

Log output can be directed to stdout (default), a log crate backend, or any custom target implementing Targetable.

Safety

This crate uses #![forbid(unsafe_code)].

License