https://github.com/paumava/carlog
Simple, lightweight crate that provides Cargo logging style messages
https://github.com/paumava/carlog
cargo logging rust
Last synced: 9 months ago
JSON representation
Simple, lightweight crate that provides Cargo logging style messages
- Host: GitHub
- URL: https://github.com/paumava/carlog
- Owner: PauMAVA
- License: mit
- Created: 2021-12-10T11:27:04.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-10T11:31:46.000Z (over 4 years ago)
- Last Synced: 2025-03-28T02:40:06.930Z (over 1 year ago)
- Topics: cargo, logging, rust
- Language: Rust
- Homepage: https://docs.rs/carlog/latest/carlog/
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# carlog
`carlog` is a simple, lightweight crate that provides Cargo logging style messages via the
`Status` struct or via multiple macros that recreate common cargo message formats:
* Cargo ok: `carlog_ok!`
* Cargo info: `carlog_info!`
* Cargo warning: `carlog_warning!`
* Cargo error: `carlog_error!`
The crate provides support for logging to both stdout and stderr and to any stream that implements
the `Write` trait.
### Import
Add the following line to your `Cargo.toml`:
```toml
carlog = "0.1.0"
```
Then import the prelude and the macros in your source file:
```rust
#[macro_use] extern crate carlog;
use carlog::prelude::*;
```
### Example
```rust
#[macro_use] extern crate carlog;
use carlog::prelude::*;
let status = Status::new().bold().justify().color(CargoColor::Green).status("Compiled");
status.print_stdout("carlog v0.1.0");
carlog_ok!("Compiled", "carlog v0.1.0");
```