Skip to content

Instantly share code, notes, and snippets.

@batok
Created February 9, 2010 17:47
Show Gist options
  • Save batok/299456 to your computer and use it in GitHub Desktop.
Save batok/299456 to your computer and use it in GitHub Desktop.
def logger(f, name=None):
# Closure to remember our name and function objects
if name is None:
name = f.func_name
def wrapped(*args, **kwargs):
#print "Calling", name, args, kwargs
log_queue.append((name, xdt.now().timetuple()[:6]))
result = f(*args, **kwargs)
#print "Called", name, args, kwargs, "returned", repr(result)
return result
wrapped.__doc__ = f.__doc__
return wrapped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment