Skip to content

Instantly share code, notes, and snippets.

Created August 3, 2012 09:48
logging-complex
import logging
logger = logging.getLogger( 'my_module' )
def some_method():
logger.debug('begin of some_method')
def main():
# Produce formater first
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# Setup Handler
console = logging.StreamHandler()
console.setLevel(logging.DEBUG)
console.setFormatter(formatter)
# Setup Logger
logger.addHandler(console)
logger.setLevel(logging.DEBUG)
some_method()
if __name__ == '__main__':
main()
@vickyi
Copy link

vickyi commented Jul 31, 2013

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment