diff --git a/gui/slick/interfaces/default/viewlogs.tmpl b/gui/slick/interfaces/default/viewlogs.tmpl index 9ef73ebe..6abb1209 100644 --- a/gui/slick/interfaces/default/viewlogs.tmpl +++ b/gui/slick/interfaces/default/viewlogs.tmpl @@ -13,10 +13,51 @@ - - -#include $os.path.join($sickbeard.PROG_DIR,"gui/slick/interfaces/default/inc_bottom.tmpl") +#include $os.path.join($sickbeard.PROG_DIR,"gui/slick/interfaces/default/inc_bottom.tmpl") \ No newline at end of file diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 385af858..81bb4d51 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -4766,13 +4766,35 @@ class ErrorLogs(WebRoot): classes.ErrorViewer.clear() return self.redirect("/errorlogs/") - def viewlog(self, minLevel=logger.INFO, maxLines=500): + def viewlog(self, minLevel=logger.INFO, logFilter="",logSearch=None, maxLines=500): t = PageTemplate(rh=self, file="viewlogs.tmpl") t.submenu = self.ErrorLogsMenu() minLevel = int(minLevel) + logNameFilters = {'': u'<No Filter>', + 'DAILYSEARCHER': u'Daily Searcher', + 'BACKLOG': u'Backlog', + 'SHOWUPDATER': u'Show Updater', + 'CHECKVERSION': u'Check Version', + 'SHOWQUEUE': u'Show Queue', + 'SEARCHQUEUE': u'Search Queue', + 'FINDPROPERS': u'Find Propers', + 'POSTPROCESSER': u'Postprocesser', + 'FINDSUBTITLES': u'Find Subtitles', + 'TRAKTCHECKER': u'Trakt Checker', + 'EVENT': u'Event', + 'ERROR': u'Error', + 'TORNADO': u'Tornado', + 'Thread': u'Thread', + 'MAIN': u'Main' + } + + if logFilter not in logNameFilters: + logFilter = '' + + data = [] if os.path.isfile(logger.logFile): with ek.ek(open, logger.logFile) as f: @@ -4793,11 +4815,15 @@ class ErrorLogs(WebRoot): if match: level = match.group(7) + logName = match.group(8) if level not in logger.reverseNames: lastLine = False continue - if logger.reverseNames[level] >= minLevel: + if logSearch and logSearch.lower() in x.lower(): + lastLine = True + finalData.append(x) + elif not logSearch and logger.reverseNames[level] >= minLevel and (logFilter == '' or logName.startswith(logFilter)): lastLine = True finalData.append(x) else: @@ -4816,6 +4842,9 @@ class ErrorLogs(WebRoot): t.logLines = result t.minLevel = minLevel + t.logNameFilters = logNameFilters + t.logFilter = logFilter + t.logSearch = logSearch return t.respond()