codechecker icon indicating copy to clipboard operation
codechecker copied to clipboard

[feature] Log formatting with colors

Open csordasmarton opened this issue 6 years ago • 5 comments

This feature will colorize the logging output of the CodeChecker commands.

Screenshots: image

With verbose debug: image

csordasmarton avatar Dec 12 '19 10:12 csordasmarton

This looks awesome! 🏆 However, the tests fail because the output is checked, and colouring escapes are recorded. It would be best to make the colouring optional. I would recommend an argument AND an environment variable. If any of those is set, no colouring should take place. This would make rewriting the tests less of an issue and would prove to be useful for the clients of the command line CodeChecker.

gamesh411 avatar Dec 12 '19 14:12 gamesh411

Codacy Here is an overview of what got changed by this pull request:


Issues
======
- Added 1
           

See the complete overview on Codacy

gyorb avatar Dec 13 '19 09:12 gyorb

Please support the TERM environment variable, next to or instead of introducing your/our own. It is conventionally set to dumb if the system does not support (or the user does not want to think it supports) advanced stuff happening, such as progress bars, line rewrites, or colours.

Another value, unknown is used in cases where the system is so utterly retarded it doesn't even understand the concept of margins, or text height, or doesn't know its own width, etc. A matrix printer from the 1960s should be an unknown, not a dumb.

See infocmp(1). On Ubuntu 18.04, both dumb and unknown (perhaps, unfortunately, but it's not much of a distinction in the 2020s) refer generally to the same thing.

╰─ infocmp -L dumb
#       Reconstructed via infocmp from file: /lib/terminfo/d/dumb
dumb|80-column dumb tty,
        auto_right_margin,
        columns#80,
        bell=^G, carriage_return=\r, cursor_down=\n,
        scroll_forward=\n,

╰─ infocmp -L unknown
#       Reconstructed via infocmp from file: /usr/share/terminfo/u/unknown
unknown|unknown terminal type,
        auto_right_margin, generic_type,
        columns#80,
        bell=^G, carriage_return=\r, cursor_down=\n,
        scroll_forward=\n,

Things like Ninja, Midnight Commander, Vim, etc. all respect these values. For example, if you want ninja to emit every step of the build, instead of overwriting the usually one line it emits, you should execute it as TERM=dumb ninja target-name.

whisperity avatar Dec 18 '19 11:12 whisperity

See example with MC:

╰─ TERM=dumb mc
Your terminal lacks the ability to clear the screen or position the cursor.

whisperity avatar Dec 18 '19 12:12 whisperity

@whisperity Can you please check this PR? I think I solved all your comments.

csordasmarton avatar Dec 22 '21 10:12 csordasmarton