tmkms icon indicating copy to clipboard operation
tmkms copied to clipboard

v0.7.0 syntax for errors

Open gaia opened this issue 5 years ago • 3 comments

v0.7.0's more forgiving timeouts are a welcome feature, thanks!

I noted that the log syntax changed in v0.7.0. I used the older syntax as a search query in papertrail to get realtime alerts on undesired events, and it used to be [warn] OR [error].

It is now #033[0m#033[31mERROR#033[0m OR #033[0m#033[31mWARN#033[0m. Was this an oversight or will warnings/errors be logged in this format from here on?

gaia avatar Dec 17 '19 16:12 gaia

This was caused by a switch to the tracing crate for logging:

https://github.com/tokio-rs/tracing

That crate is pretty much the permanently planned logging system, however it seems you are getting color logs when you probably don't want color.

It should autodetect if it's running under a TTY and not use colors if it isn't. Are you running it with a TTY?

Otherwise I should probably add a config option for whether or not colors should be used (and/or a command line argument or env var)

tarcieri avatar Dec 17 '19 16:12 tarcieri

Yes, looking at the logs directly in the client (/dev/pts/0) it is formatted properly

Dec 17 16:36:37.265 ERROR tmkms::client:

while via papertrail:

#033[2mDec 17 16:36:37.265 #033[0m#033[31mERROR#033[0m tmkms::client:

weird though is tmkms are the only logs for which this happens in papertrail. it's standard rsyslog for shipping logs to papertrail (with TLS)

How do I disable coloring?

image

gaia avatar Dec 17 '19 19:12 gaia

I will look into adding some configuration to control when it uses colors. It also looks like the TTY detection may have regressed, so I will try to add that back.

tarcieri avatar Dec 18 '19 17:12 tarcieri