Moved logging into a utils module so we don't have to duplicate it.
This commit is contained in:
15
AnkiServer/utils.py
Normal file
15
AnkiServer/utils.py
Normal 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)
|
||||
|
||||
Reference in New Issue
Block a user