Adding log levels
Logging libraries have a common idea of log levels that let you control how much information gets logged when an application is run. Let’s say you identify an error condition that needs a log message. This error should almost always be logged, but maybe there’s another place in the code where you decide that it might be useful to record what is happening. This other place is not always interesting, so it would be nice to avoid seeing those log messages all the time.
By having different log levels, you can decide how verbose your log files become. There are a couple of big problems with this approach. The first thing is simply defining what the log levels should be and what each should mean. Common log levels include errors, warnings, general informational messages, and debugging messages.
Errors tend to be easy to identify unless you also want to split them into normal errors and critical errors. What makes an error critical? Do you even need to...