[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 <odo@odoo.com>
This commit is contained in:
+1
-1
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user