shahar1 commented on code in PR #76347: URL: https://github.com/apache/airflow/pull/76347#discussion_r4457034741
########## airflow-ctl/src/airflowctl/__main__.py: ########## @@ -21,13 +21,18 @@ from __future__ import annotations +import sys + import argcomplete +import structlog from airflowctl.ctl import cli_parser from airflowctl.ctl.cli_config import safe_call_command def main(): + # stdout carries only the command's output (e.g. ``-o json``); structlog prints to stdout by default. + structlog.configure(logger_factory=structlog.PrintLoggerFactory(sys.stderr)) Review Comment: nit (non-blocking): this keeps structlog's default processors, and the default `ConsoleRenderer` picks colours from `sys.stdout.isatty()` at import time (`structlog/_config.py`). Now that the logs go to stderr, `airflowctl pools list 2> err.log` from a terminal writes ANSI escape codes into `err.log`, and `airflowctl pools list -o json > out.json` loses colour on the terminal. Cosmetic only; stdout stays clean either way. If you want it to follow stderr, the renderer can be swapped for `structlog.dev.ConsoleRenderer(colors=sys.stderr.isatty())` while keeping the other default processors. Fine to leave as-is. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
