Logging can become as complicated as your imagination permits in Python. There are modules in the standard library that cater for all scenarios I have encountered and probably many more I have not.
The documentation has extensive sections on logging. The key materials (in rough order of reading) being: