4 ms·
Don't replace the default logging mechanism. Your wrapper version with the fancy colors isn't better. Disagree pretty strongly with this one. Colors make chan
by nitrogen 5y ago
Don't replace the default logging mechanism. Your wrapper version with the fancy colors isn't better.
Disagree pretty strongly with this one. Colors make changes in the data pop instantly. Colors are for humans. Logs are for humans. Use structured data if you need computers to read it. Send that data to ELK stack. Also color is very easy to strip with a regex.
Though colors should be a logformatter on the output side, a wrapper or subclass of the system logger can still be useful for collecting context data that the system logger can't collect on its own.
- kristopolous 5y agoThe complaint wasn't color. Take laravel circa 2012 or so. All errors were expressed as like 80k of minified HTML so if you got an error in a unit test you better have a browser nearby to see it. Some other systems will try to be helpful and traverse the object and display it on the screen. I've seen some that don't understand self linking datastructures and just give you a stack exhaustion whenever dealing with an error involving one because they try to infinitely recurse. Others, trying to "fix" this problem that's been easily fixable since the 60s with pretty simple algorithms, will instead only show a depth of maybe 2 or 3 levels and then you need to do a bunch of tricks to get a useful object Other will not give thread information so you just get mystery errors without any way to attribute them. Others will race condition the log and give you a confusing mess of partial data mashed together. And yet others will just fall back to some generic "an error occurred" with no further information whatsoever. Still others will think you have no interest in strings over some random amount divisible by ten, say 50 characters long and just truncate them with no way around it. And some you are expecting a longjump or a trap or an interrupt but instead it gets intercepted for the pretty logging and thus your tooling didn't see it and the faults go undetected Then there's the ones that don't respect the call stack limit you gave the command line or the verbosity setting or things like polluting the call stack with layers of the error handlers. There's one where the default logger synced on write so if the system crashed I'd get the last message, but the fancy logger didn't so I'd just get a bunch of corruption. It was just great! They're generally speaking terribly done and I routinely have to disable them. It's just a clown car. You probably have only worked on gifted perfect projects by flawless programmers, and I congratulate you! I've dealt with mostly confused incompetent people who think they are really clever and just destroy things