When applications are running in production, they become black boxes that need to be traced and monitored. One of the simplest, yet main, ways to do so is logging. Logging allows us - at the time we develop our software - to instruct the program to emit information while the system is running that will be useful for us and our sysadmins.
Most of us have faced a point when trying to make things work with the Python
datetime
module where we resort to guess-and-check until the errors go away.
datetime
is one of those APIs
that seems easy to use but requires the developer to have a deep understanding
of what things actually mean, as otherwise it is really easy to introduce unexpected bugs
given the actual complexity of date and time related issues.
The first concept we need to grasp when working with time is