#cargo #logging #messages #style #status #stream #warnings

carlog

Simple, lightweight crate that provides Cargo logging style messages

1 unstable release

0.1.0 Dec 10, 2021

#42 in #warnings

Download history 510/week @ 2024-11-17 197/week @ 2024-11-24 356/week @ 2024-12-01 191/week @ 2024-12-08 206/week @ 2024-12-15 163/week @ 2024-12-22 327/week @ 2024-12-29 446/week @ 2025-01-05 489/week @ 2025-01-12 388/week @ 2025-01-19 535/week @ 2025-01-26 307/week @ 2025-02-02 140/week @ 2025-02-09 218/week @ 2025-02-16 102/week @ 2025-02-23 59/week @ 2025-03-02

554 downloads per month
Used in 2 crates

MIT license

17KB
270 lines

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:

carlog = "0.1.0"

Then import the prelude and the macros in your source file:

#[macro_use] extern crate carlog;

use carlog::prelude::*;

Example

#[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");

Output:

Compiled carlog v0.1.0

Dependencies

~0.1–6.5MB
~33K SLoC