Skip to content

Commit

Permalink
add readme info about level-symbols, env variable and screenshot
Browse files Browse the repository at this point in the history
Signed-off-by: Chmouel Boudjnah <chmouel@chmouel.com>
  • Loading branch information
chmouel committed Apr 27, 2022
1 parent 85fb954 commit 99a378f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Binary file added .github/screenshot-level-symbols.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ If you want to only show some levels, you can add the -f to filter by level or m

Will only show warning and error from the log.

If you pass the flag "--level-symbols" or set the environement variable `SNAZY_LEVEL_SYMBOLS`, snazy will show some pretty emojis rather than plain log level label :

![snazy level symbols](.github/screenshot-level-symbols.png)

You can customize the time printed with the `-t` option which respect the
[`strftime`](https://man7.org/linux/man-pages/man3/strftime.3.html) format
strings.
Expand Down
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,25 @@ fn construct_config(matches: clap::ArgMatches) -> Config {
std::process::exit(1);
}
}
let mut level_symbols = false;
// if the env SNAZY_LEVEL_SYMBOLS is set, we use it to set the level symbols
if let Ok(level_symbols_env) = env::var("SNAZY_LEVEL_SYMBOLS") {
level_symbols = level_symbols_env.parse::<bool>().unwrap();
}
if matches.is_present("level-symbols") {
level_symbols = true;
}

Config {
kail_no_prefix: matches.is_present("kail-no-prefix"),
level_symbols: matches.is_present("level-symbols"),
filter_levels: matches
.values_of("filter-levels")
.map(|v| v.map(String::from).collect())
.unwrap_or_else(Vec::new),
time_format: matches.value_of("time_format").unwrap().to_string(),
regexp_colours,
colored_output,
level_symbols,
// split json keys by '=' and store in a key, value hashmap
json_keys: matches
.values_of("json-keys")
Expand Down

0 comments on commit 99a378f

Please sign in to comment.