#log #formatting #format #info #icons #error #paris

paris-log

A crate that allows you to use paris's formatting with the log crate

3 stable releases

1.0.2 Apr 6, 2023

#95 in #info

Download history 140/week @ 2024-07-21 171/week @ 2024-07-28 168/week @ 2024-08-04 154/week @ 2024-08-11 111/week @ 2024-08-18 178/week @ 2024-08-25 183/week @ 2024-09-01 142/week @ 2024-09-08 158/week @ 2024-09-15 172/week @ 2024-09-22 148/week @ 2024-09-29 188/week @ 2024-10-06 200/week @ 2024-10-13 195/week @ 2024-10-20 162/week @ 2024-10-27 187/week @ 2024-11-03

769 downloads per month
Used in matugen

MIT license

11KB
115 lines

paris-log

A crate that allows you to use paris's formatting with the log crate.

Usage

Add this to your Cargo.toml:

[dependencies]
paris-log = "1"

Instead of using log macros:

use log::{info, error, ...};

You can use paris-log macros:

use paris_log::{info, error, ...};

Now you can use paris's formatting:

info!("This <cyan>is <bright green>a log<//>! <green><tick></>");

If you only need to use paris's formatting a few times, it might be better to use the full path specifier (for example, paris_log::info).

paris-log's macros should be usable just like log macros; you can use format specifiers like normal. However, they currently don't support manually specifying log target. If you need this feature, please make an issue / PR! Additionally, paris-log does not have the log macro from the log crate since it seemed repetitive.

Note

You must use a logging implementation along with this crate for logs to show up since paris-log uses the log crate internally. See here for more info. If you don't need the extra features the log crate and logging implementations provide, consider using paris itself.

The icons feature

If you have used paris, you may have noticed that logs have a nice icon in front of them to indicate if it is info, error, warn or success. paris-log can automatically do this for you if you enable the icons feature:

[dependencies]
paris-log = { version = "1", features = ["icons"] }
info!("This <cyan>is <bright green>a log<//>!");
// Without `icons` feature: This is a log!
// With `icons` feature: ℹ This is a log!

Icons will only be added to the error, warn and info macros. This feature also adds the success macro, for feature parity with paris. (the success macro uses the info log level)

Dependencies

~145KB