mirror of https://github.com/morpheus65535/bazarr
Remove construction of bazarr.log file path
Replace with use of get_log_file_path().
This commit is contained in:
parent
c827f32458
commit
65622196b7
|
@ -1,7 +1,7 @@
|
|||
# coding=utf-8
|
||||
|
||||
import io
|
||||
import os
|
||||
from utilities.central import get_log_file_path
|
||||
|
||||
from flask_restx import Resource, Namespace, fields, marshal
|
||||
|
||||
|
@ -29,7 +29,7 @@ class SystemLogs(Resource):
|
|||
def get(self):
|
||||
"""List log entries"""
|
||||
logs = []
|
||||
with io.open(os.path.join(args.config_dir, 'log', 'bazarr.log'), encoding='UTF-8') as file:
|
||||
with io.open(get_log_file_path(), encoding='UTF-8') as file:
|
||||
raw_lines = file.read()
|
||||
lines = raw_lines.split('|\n')
|
||||
for line in lines:
|
||||
|
|
|
@ -8,6 +8,7 @@ import platform
|
|||
import warnings
|
||||
|
||||
from logging.handlers import TimedRotatingFileHandler
|
||||
from utilities.central import get_log_file_path
|
||||
from pytz_deprecation_shim import PytzUsageWarning
|
||||
|
||||
from .get_args import args
|
||||
|
@ -112,10 +113,10 @@ def configure_logging(debug=False):
|
|||
# File Logging
|
||||
global fh
|
||||
if sys.version_info >= (3, 9):
|
||||
fh = PatchedTimedRotatingFileHandler(os.path.join(args.config_dir, 'log/bazarr.log'), when="midnight",
|
||||
fh = PatchedTimedRotatingFileHandler(get_log_file_path(), when="midnight",
|
||||
interval=1, backupCount=7, delay=True, encoding='utf-8')
|
||||
else:
|
||||
fh = TimedRotatingFileHandler(os.path.join(args.config_dir, 'log/bazarr.log'), when="midnight", interval=1,
|
||||
fh = TimedRotatingFileHandler(get_log_file_path(), when="midnight", interval=1,
|
||||
backupCount=7, delay=True, encoding='utf-8')
|
||||
f = FileHandlerFormatter('%(asctime)s|%(levelname)-8s|%(name)-32s|%(message)s|',
|
||||
'%Y-%m-%d %H:%M:%S')
|
||||
|
|
|
@ -9,9 +9,11 @@ from functools import wraps
|
|||
from urllib.parse import unquote
|
||||
|
||||
from constants import headers
|
||||
from literals import FILE_LOG
|
||||
from sonarr.info import url_api_sonarr
|
||||
from radarr.info import url_api_radarr
|
||||
from utilities.helper import check_credentials
|
||||
from utilities.central import get_log_file_path
|
||||
|
||||
from .config import settings, base_url
|
||||
from .database import System
|
||||
|
@ -98,9 +100,9 @@ def catch_all(path):
|
|||
|
||||
|
||||
@check_login
|
||||
@ui_bp.route('/bazarr.log')
|
||||
@ui_bp.route('/' + FILE_LOG)
|
||||
def download_log():
|
||||
return send_file(os.path.join(args.config_dir, 'log', 'bazarr.log'), max_age=0, as_attachment=True)
|
||||
return send_file(get_log_file_path(), max_age=0, as_attachment=True)
|
||||
|
||||
|
||||
@check_login
|
||||
|
|
Loading…
Reference in New Issue