Split log into frontend and backend log.

refactoring
cookietime--yay 2019-03-04 14:39:09 +01:00
parent 668157c552
commit 5535d3535f
4 changed files with 12 additions and 5 deletions

View File

@ -17,7 +17,7 @@ def shutdown():
if __name__ == '__main__':
logger = logging.getLogger()
fh = logging.FileHandler('/var/log/ticketfrei/backend.log')
fh = logging.FileHandler(config["log"]["log_backend"])
fh.setLevel(logging.DEBUG)
logger.addHandler(fh)

View File

@ -55,8 +55,14 @@ def load_env():
pass
try:
if os.environ['LOG_PATH'] != "":
configdict['log']['log_path'] = os.environ['LOG_PATH']
if os.environ['LOG_FRONTEND'] != "":
configdict['log']['log_frontend'] = os.environ['LOG_FRONTEND']
except KeyError:
pass
try:
if os.environ['LOG_BACKEND'] != "":
configdict['log']['log_backend'] = os.environ['LOG_BACKEND']
except KeyError:
pass

View File

@ -16,4 +16,5 @@ mbox_user = "root"
db_path = "/var/ticketfrei/db.sqlite"
[log]
log_path = "/var/ticketfrei/error.log"
log_frontend = "/var/ticketfrei/frontend.log"
log_backend = "/var/log/ticketfrei/backend.log"

View File

@ -265,7 +265,7 @@ def login_mastodon(user):
logger = logging.getLogger()
fh = logging.FileHandler(config['log']['log_path'])
fh = logging.FileHandler(config['log']['log_frontend'])
fh.setLevel(logging.DEBUG)
logger.addHandler(fh)