summaryrefslogtreecommitdiff
path: root/server/problems.py
diff options
context:
space:
mode:
authorAleš Smodiš <aless@guru.si>2015-10-05 17:50:23 +0200
committerAleš Smodiš <aless@guru.si>2015-10-05 17:50:23 +0200
commit63a852da581bd58975f021ef1adda07312183881 (patch)
tree22f9d8c3e192ed93b7952f3e30c0f88894498f6d /server/problems.py
parent0818b6655e8fd5ce14febd47470ac0445e3665f1 (diff)
Add logging to file to python server. Configure logfile paths from environment variables CODEQ_SERVER_LOG and CODEQ_WEB_LOG.
Diffstat (limited to 'server/problems.py')
-rw-r--r--server/problems.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/server/problems.py b/server/problems.py
index 220a746..bc124ca 100644
--- a/server/problems.py
+++ b/server/problems.py
@@ -5,6 +5,7 @@ import importlib.machinery
import threading
import os.path
from db import get_connection, return_connection
+import logging
_path_prefix = os.environ.get('CODEQ_PROBLEMS') or '/var/local/codeq-problems'
_module_loading_lock = threading.RLock() # TODO: make a more fine-grained locking import machinery
@@ -19,7 +20,7 @@ def load_module(fullname):
ff = importlib.machinery.FileFinder(d, (importlib.machinery.SourceFileLoader, ['.py']))
spec = ff.find_spec(fullname)
if spec is None:
- print('ERROR: there is no problem module {0}'.format(fullname))
+ logging.error('ERROR: there is no problem module {0}'.format(fullname))
return None
mod = type(sys)(fullname)
mod.__loader__ = spec.loader