Skip to content

Instantly share code, notes, and snippets.

@pylemon
Last active August 29, 2015 13:57
Show Gist options
  • Save pylemon/9540923 to your computer and use it in GitHub Desktop.
Save pylemon/9540923 to your computer and use it in GitHub Desktop.
import logging
logging.basicConfig(filename='testlogging.log', level=logging.DEBUG)
logger = logging.getLogger(__name__)
def foo():
try:
some_code()
except Exception:
logger.info('hihi', exc_info=True)
if __name__ == '__main__':
foo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment