Changes

Jump to navigation Jump to search
Line 41: Line 41:  
== Miscellaneous ==
 
== Miscellaneous ==
 
* Use logging.debug('foo %r bar', x) instead of logging.debug('foo %r bar' % x). This is more robust and formatting only happens if we actually log something.
 
* Use logging.debug('foo %r bar', x) instead of logging.debug('foo %r bar' % x). This is more robust and formatting only happens if we actually log something.
* When you catch an exception and want to log it, use traceback.format_exc().
+
* When you catch an exception and want to log it, use logging.exception(), this will print the whole backtrace and exception information which is very useful when debugging.
    
== Tools ==
 
== Tools ==
647

edits

Navigation menu