ezpz.log.config⚓︎
src/ezpz/logging/init.py
use_colored_logs()
⚓︎
Return False when colour should be suppressed.
Follows the no-color.org <https://no-color.org>_ convention: colour is
on by default and only disabled when NO_COLOR or NOCOLOR is set
(to any non-empty value) or TERM is dumb / unknown.
Source code in src/ezpz/log/config.py
def use_colored_logs() -> bool:
"""Return ``False`` when colour should be suppressed.
Follows the `no-color.org <https://no-color.org>`_ convention: colour is
**on** by default and only disabled when ``NO_COLOR`` or ``NOCOLOR`` is set
(to any non-empty value) or ``TERM`` is ``dumb`` / ``unknown``.
"""
term = os.environ.get("TERM", "")
if term in ("dumb", "unknown"):
return False
for var in ("NO_COLOR", "NOCOLOR"):
val = os.environ.get(var)
if val is not None and val != "":
return False
return True