From ba7cddb6fcb6e7d0382f7ab0c3eaa7c69ae1af08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marques?= Date: Thu, 3 Jun 2021 15:22:38 +0000 Subject: [PATCH] [IMP] Allow to force a colored output even if not in a tty enabled terminal Check the PY_COLORS env variable and force colored output even if the is_a_tty is no true TT24972 closes odoo/odoo#71685 Signed-off-by: Olivier Dony --- odoo/netsvc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/netsvc.py b/odoo/netsvc.py index dc54d336d70..da3e24d136e 100644 --- a/odoo/netsvc.py +++ b/odoo/netsvc.py @@ -188,7 +188,7 @@ def init_logger(): def is_a_tty(stream): return hasattr(stream, 'fileno') and os.isatty(stream.fileno()) - if os.name == 'posix' and isinstance(handler, logging.StreamHandler) and is_a_tty(handler.stream): + if os.name == 'posix' and isinstance(handler, logging.StreamHandler) and (is_a_tty(handler.stream) or os.environ.get("ODOO_PY_COLORS")): formatter = ColoredFormatter(format) perf_filter = ColoredPerfFilter() else: