crashappsec / chalk

Chalk allows you to follow code from development, through builds and into production.
https://crashoverride.com/
GNU General Public License v3.0
322 stars 11 forks source link

Disable color by default unless running in an interactive terminal #297

Open nettrino opened 1 month ago

nettrino commented 1 month ago

Description

With the current defaults escape characters appear on logs in most platforms making output harder to read

Screenshot 2024-05-28 at 11 17 41 AM
ee7 commented 1 month ago

We currently try to disable color when stdout is not a tty:

https://github.com/crashappsec/chalk/blob/b70a3faa3fc88669ef1ea7417acf5592d30fb9da/src/util.nim#L299-L300

I'll check if this needs to integrate better with the config, or e.g. the environment variables:

viega commented 1 month ago

If the call to otherSetupTasks got moved, it could be that the value is getting clobbered; since that's in Nim code, any conf file load is going to write over it. One of the things that won't be a problem when the newer con4m is merged.

If NO_COLOR is on, it will always disable the color though.

On Tue, May 28, 2024 at 8:51 AM ee7 @.***> wrote:

We currently try to disable color when stdout is not a tty:

https://github.com/crashappsec/chalk/blob/b70a3faa3fc88669ef1ea7417acf5592d30fb9da/src/util.nim#L299-L300

I'll check if this needs to integrate better with the config, or e.g. the environment variables:

  • NO_COLOR existing
  • or TERM having the value DUMB.

— Reply to this email directly, view it on GitHub https://github.com/crashappsec/chalk/issues/297#issuecomment-2135141446, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABELGQPXVT64TBQVXX7ZM4LZER4UVAVCNFSM6AAAAABIMNCPVSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZVGE2DCNBUGY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

miki725 commented 1 month ago

https://github.com/crashappsec/chalk/blob/afa093412d611dc960a8f3ed53f8a3e95cd664ae/src/chalk.nim#L13-L19

should be getting called last