Python 3 Library - Logging
Python 3 Logging Cookbook
I mentioned shell logging last time here:
I'm a Logger and I'm Okay
The other tool I use all the time in Python is the "assert" call which raises an error with message given. For example to sanity check the resulting size of a blob is matching your file size:
There's every opportunity to properly handle program output and errors.# sanity check the resultant blob is the same size as what's in the databaseassert (os.path.getsize(outpath) == len(imgblob)), "File size %d does not match blob size %d for image %d in %s saved to %s" % (os.path.getsize(outpath), len(imgblob), imgid, args.table, args.archivepath)
Ciao