Mergifyio / daiquiri

Python library to easily setup basic logging functionality
Apache License 2.0
333 stars 25 forks source link

ANSI escape character sequences are printed in Windows cmd.exe when outputting to stderr #17

Open lpinner opened 7 years ago

lpinner commented 7 years ago

I'm stuck using Windows :(for work).

The ANSI escape character sequences are printed in Windows cmd.exe when outputting to stderr.

#test.py
import daiquiri
daiquiri.setup()
logger = daiquiri.getLogger()
logger.error("something went wrong")

test I can workaround using colorama (the library that IPython uses).

#test_colour.py
import colorama 
colorama.init()

import daiquiri
daiquiri.setup()
logger = daiquiri.getLogger()
logger.error("something went wrong")

test_colour

Colours also work when script is run using ipython as colorama is being used automatically (i.e. ipython test.py).

Is there a way to tell daiquiri not to output colour escape chars?
Even better ; ), would you consider using colorama as an optional extra?

jd commented 7 years ago

Oh we should definitely switch to colorama. @blakev maybe you should take a look into that for https://github.com/jd/daiquiri/pull/9 ?

blakev commented 7 years ago

For sure, if you're not against adding the dependency.

jd commented 7 years ago

No, all good for me. Worst thing we could make it optional, but well. It's a common use case.

eli-b commented 7 years ago

Once colorama is used, you can document that Windows is supported in setup.cfg.