logsley
This is an opinionated Rust logging library.
Features
- Configure the logger with one function call
- Thread and task scoped variables
- See logging output from tests
- Works with libraries that use
log
,slog
,slog-scope
, andslog-scope-futures
. - Logs JSON by default.
Set
DEV_LOG_FORMAT=full
env var to get pretty output in your terminal. - Adjust logging verbosity of modules with simple string parameter,
and override it with the
RUST_LOG env var.
Example:RUST_LOG=some::spammy::module=warn,my::buggy::module=trace
. Seeslog-envlogger
for details.
Limitations
- Uses macros
Examples
// You should do logging like this.
For a runnable example, see examples/opinion.rs.
Set the default log level to info
.
The program will emit log messages with level info
and higher.
let _global_logger_guard = configure;
error!;
warn!;
info!;
debug!;
trace!;
Set the default log level to info
and set the level for chatty::module1
to warn
.
let _global_logger_guard = configure;
Use the environment variable to override default log level.
module1
still gets its special log level.
;
let _global_logger_guard = configure;
set_var
Use the environment variable to set module1
to debug
.
;
let _global_logger_guard = configure;
set_var
Documentation
Alternatives
- log
- log-panics
- slog
- slog-async
- slog-envlogger
- slog-json
- slog-scope
- slog-scope-futures
- slog-stdlog
- slog-term
Release Process
- Edit
Cargo.toml
and bump version number. - Run
./release.sh
Changelog
- v0.1.0 - First published version
TODO
- DONE - Try to make this crate comply with the Rust API Guidelines.
- DONE - Include Readme.md info in the crate's docs.
- DONE - Make the repo public
- DONE - Set up continuous integration tests and banner.
- DONE - Add some documentation tests
- DONE - Publish to creates.io
- DONE - Read through https://crate-ci.github.io/index.html
- DONE - Add and update a changelog
- Update it manually
- https://crate-ci.github.io/release/changelog.html
- Get a code review from an experienced rustacean
- Add features: threads, futures, term