Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seanmonstar/pretty-env-logger
A pretty, easy-to-use logger for Rust.
https://github.com/seanmonstar/pretty-env-logger
logging rust
Last synced: about 9 hours ago
JSON representation
A pretty, easy-to-use logger for Rust.
- Host: GitHub
- URL: https://github.com/seanmonstar/pretty-env-logger
- Owner: seanmonstar
- License: apache-2.0
- Created: 2016-10-20T01:49:55.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-02-13T23:40:04.000Z (10 months ago)
- Last Synced: 2024-12-05T22:05:40.100Z (7 days ago)
- Topics: logging, rust
- Language: Rust
- Homepage: https://crates.io/crates/pretty_env_logger
- Size: 50.8 KB
- Stars: 489
- Watchers: 10
- Forks: 58
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-rust-cn - seanmonstar/pretty-env-logger - to-use logger for Rust. [![Build Status](https://api.travis-ci.com/seanmonstar/pretty-env-logger.svg?branch=master)](https://travis-ci.org/seanmonstar/pretty-env-logger) (Libraries / Logging)
- awesome-rust - seanmonstar/pretty-env-logger - to-use logger. (Libraries / Logging)
- awesome-rust-cn - seanmonstar/pretty-env-logger
- awesome-rust-zh - seanmonstar/pretty-env-logger - ci.com/seanmonstar/pretty-env-logger.svg?branch=master)](https://travis-ci.org/seanmonstar/pretty-env-logger) (库 / 日志)
README
# pretty-env-logger
[![Crates.io](https://img.shields.io/crates/v/pretty_env_logger.svg)](https://crates.io/crates/pretty_env_logger)
[![Docs](https://docs.rs/pretty_env_logger/badge.svg)](https://docs.rs/pretty_env_logger)
[![MIT/APACHE-2.0](https://img.shields.io/crates/l/pretty_env_logger.svg)](https://crates.io/crates/pretty_env_logger)
[![Travis CI](https://travis-ci.org/seanmonstar/pretty-env-logger.svg?branch=master)](https://travis-ci.org/seanmonstar/pretty-env-logger)A simple logger built on top of [env_logger](https://docs.rs/env_logger).
It is configured via an environment variable and writes to standard
error with nice colored output for log levels.![example output](readme-example.png)
## Usage
Add the dependency to your `Cargo.toml`:
```toml
[dependencies]
log = "0.4"
pretty_env_logger = "0.4"
```Add some usage to your application:
```rust
extern crate pretty_env_logger;
#[macro_use] extern crate log;fn main() {
pretty_env_logger::init();
info!("such information");
warn!("o_O");
error!("much error");
}
```Then run your app with the environmental variable set:
```
RUST_LOG=trace cargo run
```## License
Licensed under either of
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)