Expand description
Small, composable backend initialization for tracing.
piquel-log is intended for applications that want a straightforward
way to install a tracing backend without exposing a large custom API.
The crate always supports console output and can optionally support file
output and log crate interoperability behind Cargo features.
§Quick start
use piquel_log::Logger;
Logger::new().init()?;
tracing::info!("hello from tracing");§Existing subscriber stacks
If your application already builds a tracing_subscriber registry, use
Logger::build and attach the returned BackendLayer yourself.
use piquel_log::Logger;
use tracing_subscriber::{filter::LevelFilter, prelude::*, Registry};
let backend = Logger::new().build()?;
let subscriber = Registry::default().with(LevelFilter::INFO).with(backend);
let _guard = tracing::subscriber::set_default(subscriber);
tracing::info!("hello from a custom stack");§log interoperability
When the log feature is enabled, Logger::with_log_bridge can install
tracing_log::LogTracer during Logger::init so that log records are
re-emitted as tracing events.
use piquel_log::Logger;
Logger::new().with_log_bridge(true).init()?;
log::warn!("bridged from log");§Feature matrix
- default: console backend only
file: configurable file outputlog: explicitlogtotracingbridge duringinitfull: enablesfileandlog
§Non-goals for v0.1
- query APIs
- target allowlists or message filters
- file rotation or retention policies
- exposing individual internal sink/layer types
Structs§
- Backend
Layer - Public tracing layer produced by
crate::Logger::build. - File
Config file - File output configuration.
- Logger
- Builder for constructing and installing the crate’s tracing backend.
Enums§
- Build
Error - Errors returned while constructing backend components.
- Init
Error - Errors returned while installing the backend globally.
- LogLevel
- Severity level of a log entry.