cli icon indicating copy to clipboard operation
cli copied to clipboard

bug: heroku logs --force-colors flag ignored

Open hraban opened this issue 6 years ago • 7 comments

heroku logs ignores the --force-colors argument when piped

Call:

heroku logs --force-colors -a my-app | cat

If bug, first try running heroku update and setting DEBUG=* to see extra debug information.

Done, nothing of interest besides the fact that the flag is clearly passed to the constructor:

heroku:logs init version: @oclif/[email protected] argv: [ '--force-colors', '-a', 'my-app' ] +0ms

What is the current behavior?

No colors

What is the expected behavior?

Colors, as they appear when you don't pipe it through anything.

node 10.16.0 heroku cli version : heroku/7.33.0 darwin-x64 node-v10.16.0 Installed latest stable using npm install heroku and used npx to double check.

hraban avatar Oct 02 '19 14:10 hraban

This is easy to test.

Try heroku logs --tail --force-colors -a my-app > output.txt. Open output.txt in sublime text or any other text editor that shows escape codes. You would expect to see the ansi codes, but you do not.

Compare this with Pygments. Install Pygments with pip, then run the command pygmentize some_code.py > output.txt. some_code.py can be any code file. Open output.txt in sublime again and you will see the ansi codes. This is what we should see with heroku if --force-colors is on.

mgroth0 avatar Feb 01 '23 22:02 mgroth0

heroku init version: @oclif/[email protected] argv: [ 'logs', '--force-colors', '-a', 'my-app' ] +0ms

Issue still there

sakishrist avatar Mar 09 '23 13:03 sakishrist

Thank you for letting us know this is still an issue. We'll look into it.

GUS ticket

k80bowman avatar Mar 09 '23 14:03 k80bowman

Awesome! Thank you! :pray: :slightly_smiling_face:

sakishrist avatar Mar 09 '23 14:03 sakishrist

Can I check on the progress with this issue? The ticket linked above seems to be private.

mgroth0 avatar Jun 09 '23 19:06 mgroth0

@mgroth0 I apologize, we have a small team and haven't had a chance to look into this one yet.

k80bowman avatar Jun 12 '23 12:06 k80bowman

This seems to still be an issue but as a workaround you should be able to force colour using the FORCE_COLOR environment variable instead. That overrides the colour setting in the underlying supports-color library instead 😄

ivomurrell avatar Oct 27 '23 11:10 ivomurrell

This should be fixed on recent versions of Heroku CLI. Let us know if you still see the issue.

sbosio avatar May 05 '25 20:05 sbosio