Created
May 7, 2016 02:08
-
-
Save mkdym/447aaa963293590619ae5582ff16733b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import logging | |
formatter = logging.Formatter('[%(asctime)s] %(levelname)-5s PID:%(process)d [%(filename)s], %(module)s %(lineno)d: %(message)s') | |
logger = logging.getLogger("") | |
console = logging.StreamHandler(sys.stdout) | |
console.setFormatter(formatter) | |
logger.addHandler(console) | |
file_handler = logging.FileHandler("/tmp/simpletest.log") | |
file_handler.setFormatter(formatter) | |
logger.addHandler(file_handler) | |
logger.setLevel(level=logging.DEBUG) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment