| Crates.io | paris-log |
| lib.rs | paris-log |
| version | 1.0.2 |
| created_at | 2023-04-06 03:20:47.363154+00 |
| updated_at | 2023-04-06 15:00:30.920112+00 |
| description | A crate that allows you to use paris's formatting with the log crate. |
| homepage | https://github.com/naturecodevoid/paris-log |
| repository | https://github.com/naturecodevoid/paris-log |
| max_upload_size | |
| id | 831904 |
| size | 11,526 |
A crate that allows you to use paris's formatting with the log crate.
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-loguses thelogcrate internally. See here for more info. If you don't need the extra features thelogcrate and logging implementations provide, consider usingparisitself.
icons featureIf 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)