daroczig / logger

A lightweight, modern and flexible, log4j and futile.logger inspired logging utility for R
https://daroczig.github.io/logger
280 stars 41 forks source link

Change text color displayed in RStudio console #107

Closed GitHunter0 closed 2 years ago

GitHunter0 commented 2 years ago

Hi folks, awesome package.

Is there a way to change the text color displayed in the RStudio console?

For example, I would like it to use the same color as print() and rlang::inform().

Thank you

daroczig commented 2 years ago

That would need a custom layout function, and although passing a color palette should be fairly easy, I'm still opposed a bit to provide a helper for that, as I'm pretty sure others might want to use the same colors, but different structure etc so trying to keep it general enough to take arguments would get too complex, if not impossible.

So I'd suggest creating your own coloring function like colorize_by_log_level, then use it via layout_glue_generator like in the layout_glue_colors example.

Sorry for not being more supportive, but I hope this helps.