mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 19:12:26 -05:00
New Feature - Log search and log filter by SR thread
This commit is contained in:
parent
e1ea013544
commit
5999e76925
@ -13,10 +13,51 @@
|
|||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
<!--
|
<!--
|
||||||
\$(document).ready(function(){
|
\$(document).ready(
|
||||||
\$('#minLevel').change(function(){
|
|
||||||
url = '$sbRoot/errorlogs/viewlog/?minLevel='+\$(this).val()
|
function(){
|
||||||
|
\$('#minLevel,#logFilter,#logSearch').change(function(){
|
||||||
|
if ( \$('#logSearch').val().length > 0 ) {
|
||||||
|
\$('#logSearch').prop('disabled', true);
|
||||||
|
\$('#logFilter option[value=<NONE>]').prop('selected', true);
|
||||||
|
\$('#minLevel option[value=INFO]').prop('selected', true);
|
||||||
|
}
|
||||||
|
\$('#minLevel').prop('disabled', true);
|
||||||
|
\$('#logFilter').prop('disabled', true);
|
||||||
|
\$('#logSearch').prop('disabled', true);
|
||||||
|
document.body.style.cursor='wait'
|
||||||
|
url = '$sbRoot/errorlogs/viewlog/?minLevel='+\$('select[name=minLevel]').val()+'&logFilter='+\$('select[name=logFilter]').val()+'&logSearch='+\$('#logSearch').val()
|
||||||
window.location.href = url
|
window.location.href = url
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
\$(window).load(function(){
|
||||||
|
|
||||||
|
if ( \$('#logSearch').val().length == 0 ) {
|
||||||
|
\$('#minLevel').prop('disabled', false);
|
||||||
|
\$('#logFilter').prop('disabled', false);
|
||||||
|
\$('#logSearch').prop('disabled', false);
|
||||||
|
} else {
|
||||||
|
\$('#minLevel').prop('disabled', true);
|
||||||
|
\$('#logFilter').prop('disabled', true);
|
||||||
|
\$('#logSearch').prop('disabled', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.style.cursor='default';
|
||||||
|
});
|
||||||
|
|
||||||
|
\$('#logSearch').keyup(function() {
|
||||||
|
if ( \$('#logSearch').val().length == 0 ) {
|
||||||
|
\$('#logFilter option[value=<NONE>]').prop('selected', true);
|
||||||
|
\$('#minLevel option[value=INFO]').prop('selected', true);
|
||||||
|
\$('#minLevel').prop('disabled', false);
|
||||||
|
\$('#logFilter').prop('disabled', false);
|
||||||
|
url = '$sbRoot/errorlogs/viewlog/?minLevel='+\$('select[name=minLevel]').val()+'&logFilter='+\$('select[name=logFilter]').val()+'&logSearch='+\$('#logSearch').val()
|
||||||
|
window.location.href = url
|
||||||
|
} else {
|
||||||
|
\$('#minLevel').prop('disabled', true);
|
||||||
|
\$('#logFilter').prop('disabled', true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//-->
|
//-->
|
||||||
@ -35,6 +76,14 @@ $levels.sort(lambda x,y: cmp($reverseNames[$x], $reverseNames[$y]))
|
|||||||
<option value="$reverseNames[$level]" #if $minLevel == $reverseNames[$level] then "selected=\"selected\"" else ""#>$level.title()</option>
|
<option value="$reverseNames[$level]" #if $minLevel == $reverseNames[$level] then "selected=\"selected\"" else ""#>$level.title()</option>
|
||||||
#end for
|
#end for
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
Filter log by: <select name="logFilter" id="logFilter" class="form-control form-control-inline input-sm">
|
||||||
|
#for $logNameFilter in sorted($logNameFilters)
|
||||||
|
<option value="$logNameFilter" #if $logFilter == $logNameFilter then "selected=\"selected\"" else ""#>$logNameFilters[$logNameFilter]</option>
|
||||||
|
#end for
|
||||||
|
</select>
|
||||||
|
Search log by:
|
||||||
|
<input type="text" name="logSearch" id="logSearch" value="#if $logSearch then $logSearch else ""#" class="form-control form-control-inline input-sm" />
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div class="align-left"><pre>
|
<div class="align-left"><pre>
|
||||||
@ -48,10 +97,4 @@ window.setInterval( "location.reload(true)", 600000); // Refresh every 10 minute
|
|||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
<!--
|
|
||||||
window.setInterval( "location.reload(true)", 600000); // Refresh every 10 minutes
|
|
||||||
//-->
|
|
||||||
</script>
|
|
||||||
|
|
||||||
#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")
|
@ -4732,13 +4732,35 @@ class ErrorLogs(WebRoot):
|
|||||||
classes.ErrorViewer.clear()
|
classes.ErrorViewer.clear()
|
||||||
return self.redirect("/errorlogs/")
|
return self.redirect("/errorlogs/")
|
||||||
|
|
||||||
def viewlog(self, minLevel=logger.INFO, maxLines=500):
|
def viewlog(self, minLevel=logger.INFO, logFilter="<NONE>",logSearch=None, maxLines=500):
|
||||||
|
|
||||||
t = PageTemplate(rh=self, file="viewlogs.tmpl")
|
t = PageTemplate(rh=self, file="viewlogs.tmpl")
|
||||||
t.submenu = self.ErrorLogsMenu()
|
t.submenu = self.ErrorLogsMenu()
|
||||||
|
|
||||||
minLevel = int(minLevel)
|
minLevel = int(minLevel)
|
||||||
|
|
||||||
|
logNameFilters = {'<NONE>': 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 = '<NONE>'
|
||||||
|
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
if os.path.isfile(logger.logFile):
|
if os.path.isfile(logger.logFile):
|
||||||
with ek.ek(open, logger.logFile) as f:
|
with ek.ek(open, logger.logFile) as f:
|
||||||
@ -4759,11 +4781,15 @@ class ErrorLogs(WebRoot):
|
|||||||
|
|
||||||
if match:
|
if match:
|
||||||
level = match.group(7)
|
level = match.group(7)
|
||||||
|
logName = match.group(8)
|
||||||
if level not in logger.reverseNames:
|
if level not in logger.reverseNames:
|
||||||
lastLine = False
|
lastLine = False
|
||||||
continue
|
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 == '<NONE>' or logName.startswith(logFilter)):
|
||||||
lastLine = True
|
lastLine = True
|
||||||
finalData.append(x)
|
finalData.append(x)
|
||||||
else:
|
else:
|
||||||
@ -4782,6 +4808,9 @@ class ErrorLogs(WebRoot):
|
|||||||
|
|
||||||
t.logLines = result
|
t.logLines = result
|
||||||
t.minLevel = minLevel
|
t.minLevel = minLevel
|
||||||
|
t.logNameFilters = logNameFilters
|
||||||
|
t.logFilter = logFilter
|
||||||
|
t.logSearch = logSearch
|
||||||
|
|
||||||
return t.respond()
|
return t.respond()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user