loguru icon indicating copy to clipboard operation
loguru copied to clipboard

'Pretty logging with colors' available for .log files?

Open deployment-ian opened this issue 3 years ago • 2 comments
trafficstars

I have been banging around with the ideolog plugin for pycharm and I have not had success for producing a usable format for the output log files that would mirror what is printed to console.

The following portion of the documentation produces marvelous results to the console:

image

Would it be possible to have similar formatting on the output log files?

Here is what I see on the console vs what I see on the log file: image

image

deployment-ian avatar Sep 02 '22 15:09 deployment-ian

And I forgot to mention how much I love loguru... truly an awesome library.

deployment-ian avatar Sep 02 '22 15:09 deployment-ian

Hi @deployment-ian, glad you like Loguru. ;)

There is no colors in a log files. Displaying colors is a "feature" of terminal but files are not designed to contain colors.

You can still force the "color codes" (which work on terminal) to be displayed by specifying colorize=True when adding your file sink, but it will likely not produce the output you expect.

Delgan avatar Sep 04 '22 14:09 Delgan

Closing as I answered your question but feel free to re-open it otherwise.

Delgan avatar Oct 09 '22 09:10 Delgan