Moved logging into a utils module so we don't have to duplicate it.

This commit is contained in:
David Snopek
2013-07-16 19:50:45 +01:00
parent f33b655717
commit 1349178157
2 changed files with 17 additions and 8 deletions

15
AnkiServer/utils.py Normal file
View File

@@ -0,0 +1,15 @@
def setup_logging(config_file):
"""Setup logging based on a config_file."""
import logging
# monkey patch the logging.config.SMTPHandler if necessary
import sys
if sys.version_info[0] == 2 and sys.version_info[1] == 5:
import AnkiServer.logpatch
# load the config file
import logging.config
logging.config.fileConfig(config_file)