4 ms·
In addition to the issues other comments raise, WARNING is useful separately because while INFO says "something happened", WARNING says "something weird/unlikel
by gary_0 2y ago
In addition to the issues other comments raise, WARNING is useful separately because while INFO says "something happened", WARNING says "something weird/unlikely happened". I often use it for edge cases I don't think are possible but haven't been able to rule out, among other useful debugging strategies. Warnings may not require action like errors, but they should still stand out.
When I don't have LogLevel.Warning or the like, I end up doing things like adding a "WARNING:" prefix to the message so it stands out and can be grepped, but it's much better when I can just use the LogLevel to filter, color the message, show it in the UI, etc.
- mekster 2y ago> something weird/unlikely happened This is already an error. Warning is supposed to be before anything weird takes place.
- citrin_ru 2y agoFor me the difference between WARN and ERROR is in how likely you need to take an action if a error happens: WARN - something is off a happy path but it's either out of you control (external system sent a broken request) or not urgent (e. g. use of a deprecated API) or should be handled gracefully (timeout for a sub-request with multiple retries, a request may still succeed but with high response time) ERROR - you need to take action or at least may need - e. g. indication of a bug or a problem in the infrastructure (cannot connect to a database or disk is full, or a process has run out of file descriptors, an expired certificate, invalid auth token e. t. c.). Of course one can lamp two these levels together but it makes Ops work harder.