Skip to content

Instantly share code, notes, and snippets.

@j0lvera
Last active October 24, 2016 01:38
Show Gist options
  • Save j0lvera/f808d2cfcb2f8a0c907a to your computer and use it in GitHub Desktop.
Save j0lvera/f808d2cfcb2f8a0c907a to your computer and use it in GitHub Desktop.
logging with python
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
handler = logging.FileHandler(config.log_path)
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - '
'%(levelname)s - %(message)s')
handler.setFormatter(formatter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment