-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Labels
Milestone
Description
Hey @ashb! It seems like environment variable overrides and TTY check are not working anymore because colors is never None after this was merged.
Here's the overrides and TTY check I'm talking about:
airflow/shared/logging/src/airflow_shared/logging/structlog.py
Lines 404 to 434 in 6f1a20f
| :param colors: Whether to use colors for non-JSON logs. If `None` is passed, then colors are used | |
| if standard out is a TTY (that is, an interactive session). | |
| It's possible to override this behavior by setting two standard environment variables to any value | |
| except an empty string: | |
| * ``FORCE_COLOR`` activates colors, regardless of where output is going. | |
| * ``NO_COLOR`` disables colors, regardless of where the output is going and regardless the value of | |
| ``FORCE_COLOR``. Please note that ``NO_COLOR`` disables all styling, including bold and italics. | |
| :param callsite_parameters: A list parameters about the callsite (line number, function name etc) to | |
| include in the logs. | |
| If ``log_format`` is specified, then anything required to populate that (such as ``%(lineno)d``) will | |
| be automatically included. | |
| :param namespace_log_levels: Levels of extra loggers to configure. | |
| To make this easier to use, this can be a string consisting of pairs of ``<logger>=<level>`` (either | |
| string, or space delimited) which will set the level for that specific logger. | |
| For example:: | |
| ``sqlalchemy=INFO sqlalchemy.engine=DEBUG`` | |
| """ | |
| if "fatal" not in NAME_TO_LEVEL: | |
| NAME_TO_LEVEL["fatal"] = NAME_TO_LEVEL["critical"] | |
| if colors is None: | |
| colors = os.environ.get("NO_COLOR", "") == "" and ( | |
| os.environ.get("FORCE_COLOR", "") != "" | |
| or (sys.stdout is not None and hasattr(sys.stdout, "isatty") and sys.stdout.isatty()) | |
| ) |
Originally posted by @ramitkataria in #55824 (comment)