Conversation
| console=console, | ||
| ) | ||
| rich_handler.setFormatter(logging.Formatter("%(message)s")) | ||
| logger.addHandler(rich_handler) |
There was a problem hiding this comment.
Why did you remove logger.addHandler(rich_handler)?
There was a problem hiding this comment.
I removed rich handler because, as a part of https://github.com/Textualize/rich it makes assumptions about output being console. In no way does this compromise logging capabilities when output is redirected to file.
Logging handlers and formatters can be set by the outside code, e.g. the way you set logging config for uvicorn here: https://github.com/fastapi/fastapi-cli/blob/main/src/fastapi_cli/cli.py#L180
Here is how I set logging config via a single yaml
svlandeg
left a comment
There was a problem hiding this comment.
The CI on the PR is failing, can you look into that @asokolsky ?
|
As this PR has been waiting for the original user for a while but seems to be inactive, it's now going to be closed. But if there's anyone interested, feel free to create a new PR. |
Do NOT use rich logger when fastapi cli output is redirected or piped.
For the output to a terminal the behavior is unchanged.