Skip to content

Instantly share code, notes, and snippets.

@fidothe
Created May 8, 2012 13:15
Show Gist options
  • Save fidothe/2634870 to your computer and use it in GitHub Desktop.
Save fidothe/2634870 to your computer and use it in GitHub Desktop.
(make_mozilla)Gad:make.mozilla.org matt$ python manage.py shell
Python 2.6.7 (r267:88850, Jul 31 2011, 19:30:54)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import commonware.log
>>> log = commonware.log.getLogger('mk.tasks')
>>> log.info('HELLZ YEAH')
>>> from make_mozilla.base.decorators import log_execution
>>> log_execution(log.error)
<function log_execution_decorator at 0x111ce2f50>
>>> @log_execution(log.error)
... def a_thing():
... print 'ALLO'
...
>>> a_thing()
No handlers could be found for logger "mk.tasks"
ALLO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment