Closed manio closed 2 years ago
So what I think would be in scope is some kind of filter for control sequences at least.
Maybe an additional wrapping-logger could be provided, that does remove control sequences and can then be used in conjunction with e.g. WriteLogger
.
paris
looks like a really nice crate from an api-perspective. But I am not sure, how much code this would add to simplelog
and if it would not be better to implement a new crate similar to paris
, but with log
support. (Essentially just proxy-ing the log-macros.)
That said, I would definitely consider having a tight integration with a crate like that in simplelog. I am just not sure, if I want to maintain all that parsing code myself.
I see, thank you for fast answer. Because this is not a issue "per se" so I am closing it for now... will reopen when necessary.
Just for future reference... I did it like this:
use paris::formatter::colorize_string;
//standard simplelog initialize
let t = colorize_string("<blue><on-bright-red> This text is blue on a bright red background</> it's a pain");
info!("{}", t);
//or:
warn!("{}", colorize_string("<b><green>test string"));
I will now search how can I wrap it in some macro (proxy as you mention) to be able to use it like before using just info!
, warn!
, etc
If you manage to do that, I would accept those macros (assuming they would be rather simple) in simplelog behind a (by default disabled) optional paris
feature.
Great, added a PR #84. Let's move discussion there...
Hi! I really like use your simplelog as my main logger for projects :) I am now experimenting with adding support for bold/italic and colors in my log messages. I am not aware of this with the simplelog (correct me if I am wrong), so I am using an ansi_term crate for this.
The downsides of this approach:
Style::new().bold().fg(Green).paint(err.to_string())
I want to ask what is your opinion to have in simplelog something similar as in paris, ie parser for the following:
log.info("<blue><on-bright-red> This text is blue on a bright red background</> it's a pain");
I am not sure if the above parsing is even possible when using error!, info! macros from rust...?Is it in a scope of this project?