Closed vikramsubramanian closed 2 months ago
By default, Loguru tries to automatically detect whether or not the terminal supports colors. Maybe this is a false-negative case.
You can force colored output by adding you sink with colorize=True
. Does it work better?
Thank you, that worked eg. see [this](
You could fix the false-negative case by detecting the environment variable:
GITHUB_ACTIONS
Always set to true when GitHub Actions is running the workflow. You can use this variable to differentiate when tests are being run locally or by GitHub Actions. (from [here](
Great, I will do that, thanks. :+1:
Why are some logs not colored in the Github Actions output you shared, though? Is it due to InterceptHandler
or something?
That script is using the standard logger and then imports another library of mine where the InterceptHandler
is set up so I guess it is because of that.
I guess it would go here:
if any(x in os.environ for x in ("PYCHARM_HOSTED", "GITHUB_ACTIONS")):
return True
Fixed on master
branch. :+1:
I have found that log output is coloured when running locally but not when running through GitHub Actions. Is there something I need to do to get colour in GitHub Actions?
I noticed in a comment here: that "humanfriendly.terminal.terminal_supports_colors actually returns False on the github runner (ubuntu-latest)". Could that be the problem?
GitHub Actions does support colour eg. from another logger:
![screenshot-github com-2022 02 24-17_15_46](