Use env var for DEBUG

This commit is contained in:
2020-08-23 14:23:45 +02:00
parent baccd3b22b
commit 7a560181f7
4 changed files with 8 additions and 11 deletions

View File

@@ -33,15 +33,16 @@ LIM_TIME = 2.5 # deletes what's after
DELAY = 10 * 60 # xml cache & ETag cache (in sec)
TIMEOUT = 4 # http timeout (in sec)
DEBUG = False
class MorssException(Exception):
pass
def log(txt, force=False):
if DEBUG or force:
def log(txt):
if ('DEBUG' in os.environ
or ':debug' in os.environ.get('REQUEST_URI', '')
or ':debug' in os.environ.get('PATH_INFO', '')
):
if 'REQUEST_URI' in os.environ:
open('morss.log', 'a').write("%s\n" % repr(txt))