Closed My1 closed 4 years ago
This is because your terminal doesn't support coloured output.
I would suggest you use https://github.com/microsoft/terminal which is the new terminal from Microsoft, but I think it's only available for Windows 10.
There might be a way for Caddy to detect if a terminal does not have colour support and skip printing those characters, but I'm not certain.
Edit: we could possibly use https://github.com/efekarakus/termcolor
The colors come from uber-go/zap.
https://github.com/caddyserver/caddy/blob/6e4132eb89ccf399c97c9439f6f9ff9fcac21956/logging.go#L679
I assume customizing it will require a wrapper writer/encoder? @mholt would know for sure. He dove deep into zap.
You can customize the log output: https://caddyserver.com/docs/json/logging/
You'll want to choose an encoder that you like, and customize it (or write a new one).
wouldn't it be nice if the messages would be easy to read by humans (like in caddy 1)?
compare this
to this
like what is that "←[33m" and so on about? also at least for dev where I dont leave caddy running for days or even years at a time I could live with Hours minutes and seconds only.
by changing
2020/05/07 08:17:45.996 ←[34mINFO←[0m
to08:17:45 INFO
it becomes a lot easier to read, also using linebreaks at the right time may help.This is with caddy2.0 on windows 8.1.