Add 'Download Log' to 'Logs & Errors' page.

This commit is contained in:
Prinz23 2016-11-02 02:36:49 +01:00 committed by JackDandy
parent fbabe57584
commit 90430b2d35
9 changed files with 68 additions and 45 deletions

View file

@ -190,6 +190,7 @@
* Add search setting "Disable auto full backlog"
* Change improve performance and reduce start up time
* Fix button "Checkout branch" when stuck on disabled
* Add 'Download Log' to 'Logs & Errors' page
[develop changelog]
* Change send nzb data to NZBGet for Anizb instead of url

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

Binary file not shown.

View file

@ -502,6 +502,10 @@ inc_top.tmpl
content:"\e621"
}
.sgicon-download:before{
content:"\e626"
}
.sgicon-emby:before {
content: "\e900"
}

View file

@ -6,6 +6,7 @@ function initActions() {
$('#SubMenu a:contains("Remove")').addClass('btn remove').html('<i class="sgicon-delete"></i>Remove');
$('#SubMenu a:contains("Clear History")').addClass('btn clearhistory').html('<i class="sgicon-delete"></i>Clear History');
$('#SubMenu a:contains("Trim History")').addClass('btn trimhistory').html('<i class="sgicon-trim"></i>Trim History');
$('#SubMenu a[href$="/errorlogs/downloadlog/"]').addClass('btn').html('<i class="sgicon-download"></i>Download Log');
$('#SubMenu a[href$="/errorlogs/clearerrors/"]').addClass('btn').html('<i class="sgicon-delete"></i>Clear Errors');
$('#SubMenu a:contains("Re-scan")').addClass('btn').html('<i class="sgicon-refresh"></i>Re-scan');
$('#SubMenu a:contains("Backlog Overview")').addClass('btn').html('<i class="sgicon-backlog"></i>Backlog Overview');

View file

@ -312,4 +312,8 @@ def close():
def log_set_level():
if sb_log_instance.cur_handler:
sb_log_instance.cur_handler.setLevel(reverseNames[sickbeard.FILE_LOGGING_PRESET])
sb_log_instance.cur_handler.setLevel(reverseNames[sickbeard.FILE_LOGGING_PRESET])
def current_log_file():
return os.path.join(sickbeard.LOG_DIR, sb_log_instance.log_file)

View file

@ -5480,7 +5480,8 @@ class UI(MainHandler):
class ErrorLogs(MainHandler):
@staticmethod
def ErrorLogsMenu():
return [{'title': 'Clear Errors', 'path': 'errorlogs/clearerrors/'},]
return [{'title': 'Download Log', 'path': 'errorlogs/downloadlog/'},
{'title': 'Clear Errors', 'path': 'errorlogs/clearerrors/'},]
def index(self, *args, **kwargs):
@ -5493,6 +5494,12 @@ class ErrorLogs(MainHandler):
classes.ErrorViewer.clear()
self.redirect('/errorlogs/')
def downloadlog(self, *args, **kwargs):
self.set_header('Content-Type', 'text/plain')
self.set_header('Content-Disposition', 'attachment; filename=sickgear.log')
with open(logger.current_log_file(), 'r') as logfile:
return logfile.read()
def viewlog(self, minLevel=logger.MESSAGE, maxLines=500):
t = PageTemplate(headers=self.request.headers, file='viewlogs.tmpl')