Crates.io | my-env-logger-style |
lib.rs | my-env-logger-style |
version | 0.2.0 |
source | src |
created_at | 2023-05-06 19:36:30.338189 |
updated_at | 2024-03-29 14:06:12.671586 |
description | pretty, opinionated style for env_logger |
homepage | |
repository | https://github.com/LuckyTurtleDev/my-env-logger-style |
max_upload_size | |
id | 858710 |
size | 35,978 |
A pretty, opinionated style for env_logger inspirated by pretty-env-logger.
It is not a goal of this crate to create a feature rich wrapper around env_logger. Instead it does provide a formater, which can be applied to the env_logger::Builder
. Additional an optional function to create and register a zero config logger is provided.
Timestamp, emojis and modules can be disable separately.
with timestamps:
my_env_logger_style::just_log();
info!("Hello, world!");
This creates the default env_logger from environment variables and register it as logger.
You can also create an env_logger::Builder
and apply the style definded at this crate, by using the format()
function.
use log::info;
use my_env_logger_style::format;
env_logger::Builder::new()
.parse_default_env()
.format(format)
.init();
info!("Hello, world!");
Enable RFC3339 timestamps
Allow using a custom formater to format the args (the actual message) of the log record. As example this can be used to avoid logging private userdata.