Skip to content

Instantly share code, notes, and snippets.

View gchina's full-sized avatar

Grant China gchina

  • Honolulu, Hawaii, USA
View GitHub Profile
@gchina
gchina / funclog.py
Created February 27, 2017 01:29
A decorator that provides input/output debug logging for function calls.
"""
This module provides a decorator that can be added to any function to provide
debug output that shows the values of the arguments passed in as well as the
return value. If a Logger object is passed in to the decorator, all debug
output will go to that Logger object. Otherwise, the output will go to the
default Logger object.
Tip: If using the default Logger object, don't forget to set the logging level
to DEBUG if you want to see output on stdout.