Open Gerenuk opened 6 years ago
I never tried. Do you have some links or code sample you can share that can help understanding the issue and how to solve it?
I'm using the standard
import logging import daiquiri daiquiri.setup(level=logging.INFO, outputs=[daiquiri.output.STDOUT]) logger = daiquiri.getLogger(name) logger.info("It works and log to stderr by default with color!")
in Jupyter notebook. The STDOUT is needed since Jupyter uses a red background for stderr. It works correctly in consoles, but uses no color in Jupyter.
I noticed in some other terminal color libraries that enforcing TTY is important. For example
import coloredlogs, logging, sys logger = logging.getLogger(name) coloredlogs.install(level='DEBUG', stream=sys.stdout, isatty=True)
That isatty
is key to really have colors in Jupyter. Somehow Jupyter does not identify itself as a proper TTY. Not sure what that means though.
Daiquiri would also be great to use in Jupyter. Unfortunately, it seems in Jupyter one usually has to enforce TTY mode in order to make color work.
There does not seem to be an option for that in daiquiri?