4 ms·
It's certainly low on the list of priorities to test, but yeah, testing all your logging calls is useful. It's how you avoid having something break in productio
by plorkyeran 2y ago
It's certainly low on the list of priorities to test, but yeah, testing all your logging calls is useful. It's how you avoid having something break in production in a non-reproducible way, checking your logs, and discovering that you've been logging your language's equivalent of [object Object] ever since someone refactored that code last year.
- shermantanktop 2y agoI once refactored a server-side codebase due to poor performance, and a significant time suck was - I kid you not - this line (in pseudocode): logger.info(“Request:” + JSON.stringify(httpRequest)); Terrible! I removed it, deployed it, and…alarms went off. It turned out that the line in question was being used to populate a critical metrics feed. In that terrible, terrible case, I agree that the load-bearing log line should be tested. In any other scenario I’d personally avoid it, outside of mission critical medical or other codebases. But that’s me, I understand the impulse to test it.