mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-05 10:58:01 -05:00
Fixed few misc things related to new logging code and webapi
This commit is contained in:
parent
9dc03c5d6a
commit
949c56439c
@ -89,7 +89,7 @@ def change_LOG_DIR(log_dir, web_log):
|
||||
sickbeard.ACTUAL_LOG_DIR = os.path.normpath(log_dir)
|
||||
sickbeard.LOG_DIR = abs_log_dir
|
||||
|
||||
logger.sb_log_instance.initLogging()
|
||||
logger.initLogging()
|
||||
logger.log(u"Initialized new log file in " + sickbeard.LOG_DIR)
|
||||
log_dir_changed = True
|
||||
|
||||
|
@ -27,6 +27,8 @@ import threading
|
||||
import sickbeard
|
||||
from sickbeard import classes
|
||||
|
||||
censoredItems = {}
|
||||
|
||||
# log levels
|
||||
ERROR = logging.ERROR
|
||||
WARNING = logging.WARNING
|
||||
@ -40,8 +42,6 @@ reverseNames = {u'ERROR': ERROR,
|
||||
u'DEBUG': DEBUG,
|
||||
u'DB': DB}
|
||||
|
||||
censoredItems = {}
|
||||
|
||||
# send logging to null
|
||||
class NullFilter(logging.Filter):
|
||||
def filter(self, record):
|
||||
@ -54,9 +54,7 @@ class CensorFilter(logging.Filter):
|
||||
record.msg = record.msg.replace(v, len(v) * '*')
|
||||
return True
|
||||
|
||||
def initLogging(consoleLogging=False, fileLogging=False, debug=False):
|
||||
logFile = os.path.join(sickbeard.LOG_DIR, 'sickrage.log')
|
||||
|
||||
def initLogging(logFile=os.path.join(sickbeard.LOG_DIR, 'sickrage.log'), consoleLogging=False, fileLogging=False, debug=False):
|
||||
# Add a new logging level DB
|
||||
logging.addLevelName(DB, 'DB')
|
||||
|
||||
|
@ -1278,8 +1278,8 @@ class CMD_Logs(ApiCall):
|
||||
minLevel = logger.reverseNames[str(self.min_level).upper()]
|
||||
|
||||
data = []
|
||||
if os.path.isfile(logger.sb_log_instance.log_file_path):
|
||||
with ek.ek(open, logger.sb_log_instance.log_file_path) as f:
|
||||
if os.path.isfile(logger.logFile):
|
||||
with ek.ek(open, logger.logFile) as f:
|
||||
data = f.readlines()
|
||||
|
||||
regex = "^(\d\d\d\d)\-(\d\d)\-(\d\d)\s*(\d\d)\:(\d\d):(\d\d)\s*([A-Z]+)\s*(.+?)\s*\:\:\s*(.*)$"
|
||||
|
@ -4663,8 +4663,8 @@ class ErrorLogs(WebRoot):
|
||||
minLevel = int(minLevel)
|
||||
|
||||
data = []
|
||||
if os.path.isfile(logger.sb_log_instance.log_file_path):
|
||||
with ek.ek(open, logger.sb_log_instance.log_file_path) as f:
|
||||
if os.path.isfile(logger.logFile):
|
||||
with ek.ek(open, logger.logFile) as f:
|
||||
data = f.readlines()
|
||||
|
||||
regex = "^(\d\d\d\d)\-(\d\d)\-(\d\d)\s*(\d\d)\:(\d\d):(\d\d)\s*([A-Z]+)\s*(.+?)\s*\:\:\s*(.*)$"
|
||||
|
@ -54,8 +54,7 @@ FILEDIR = os.path.join(TESTDIR, SHOWNAME)
|
||||
FILEPATH = os.path.join(FILEDIR, FILENAME)
|
||||
SHOWDIR = os.path.join(TESTDIR, SHOWNAME + " final")
|
||||
|
||||
#sickbeard.logger.sb_log_instance = sickbeard.logger.SBRotatingLogHandler(os.path.join(TESTDIR, 'sickbeard.log'), sickbeard.logger.NUM_LOGS, sickbeard.logger.LOG_SIZE)
|
||||
sickbeard.logger.SBRotatingLogHandler.log_file = os.path.join(os.path.join(TESTDIR, 'Logs'), 'test_sickbeard.log')
|
||||
sickbeard.logger.initLogging(os.path.join(os.path.join(TESTDIR, 'Logs'), 'test_sickbeard.log'))
|
||||
|
||||
#=================
|
||||
# prepare env functions
|
||||
@ -92,7 +91,7 @@ sickbeard.PROG_DIR = os.path.abspath('..')
|
||||
sickbeard.DATA_DIR = sickbeard.PROG_DIR
|
||||
sickbeard.LOG_DIR = os.path.join(TESTDIR, 'Logs')
|
||||
createTestLogFolder()
|
||||
sickbeard.logger.sb_log_instance.initLogging(False)
|
||||
sickbeard.logger.initLogging(False)
|
||||
|
||||
sickbeard.CACHE_DIR = os.path.join(TESTDIR, 'cache')
|
||||
createTestCacheFolder()
|
||||
|
Loading…
Reference in New Issue
Block a user