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

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

#575 in Debugging

Download history 61/week @ 2023-12-22 19/week @ 2023-12-29 9/week @ 2024-01-05 4/week @ 2024-01-12 9/week @ 2024-01-19 24/week @ 2024-01-26 46/week @ 2024-02-02 40/week @ 2024-02-09 180/week @ 2024-02-16 335/week @ 2024-02-23 319/week @ 2024-03-01 254/week @ 2024-03-08 303/week @ 2024-03-15 298/week @ 2024-03-22 326/week @ 2024-03-29 165/week @ 2024-04-05

1,132 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