Adding logging to your code
Adding event logging in your code will be different in Go and in Python and will vary depending on the library used in your code. But the idea for both languages is to divide the information into severity levels, as done in syslog
.
The severity log levels will also vary depending on the library used. Python and Go have standard log libraries, but you are also able to use third-party libraries to log events in both languages.
One important point here is that when writing the code, you will decide whether there is a need to add a logging event line. The line of logging added must carry some information that will signal to the program which level of severity the message is. Therefore, important messages such as failures will have priority over less-important messages, such as debugging. Ideally, the decision about which level of logging should be exposed is normally made by adding input arguments to your program that allow setting the log level. So, if...