General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Lawrence D’Oliveiro
Tech With Tim
comments
Comments by "Lawrence D’Oliveiro" (@lawrencedoliveiro9104) on "Python Logging - Tutorial" video.
The logging module just gives you more control over message output, that’s all. If you use sys.stderr.write, then you have to do your own implementation of verbosity levels, for example. The standard Python module has already pre-invented this whole wheel (and much else besides), so you don’t have to.
1
The second version is fine, too. Note that the docs state that no formatting substitution is done on the message string if no formatting arguments are supplied. Compare, say, printf(3), which always does formatting substitution even when it doesn’t make sense. Python is a bit smarter.
1