Improve logging.
Make format_time() handle datetime objects as well as struct_time objects.
typo.
Don't pass table names as bound params (the mysql python library doesn't handle them correctly).