mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 10:33:38 +00:00
Change send download logfile as stream.
This commit is contained in:
parent
89a2405c99
commit
4001944928
2 changed files with 15 additions and 3 deletions
|
@ -226,6 +226,7 @@
|
||||||
* Change improve TvChaos item parsing and can use qualities instead of 'Unknown'
|
* Change improve TvChaos item parsing and can use qualities instead of 'Unknown'
|
||||||
* Change remove deprecated providers being saved to config
|
* Change remove deprecated providers being saved to config
|
||||||
* Change prevent a missing slash typo and correct develop typo after a network outage
|
* Change prevent a missing slash typo and correct develop typo after a network outage
|
||||||
|
* Change send download logfile as stream
|
||||||
|
|
||||||
|
|
||||||
### 0.11.16 (2016-10-16 17:30:00 UTC)
|
### 0.11.16 (2016-10-16 17:30:00 UTC)
|
||||||
|
|
|
@ -5495,10 +5495,21 @@ class ErrorLogs(MainHandler):
|
||||||
self.redirect('/errorlogs/')
|
self.redirect('/errorlogs/')
|
||||||
|
|
||||||
def downloadlog(self, *args, **kwargs):
|
def downloadlog(self, *args, **kwargs):
|
||||||
self.set_header('Content-Type', 'text/plain')
|
logfile_name = logger.current_log_file()
|
||||||
|
self.set_header('Content-Type', 'application/octet-stream')
|
||||||
|
self.set_header('Content-Description', 'Logfile Download')
|
||||||
|
self.set_header('Content-Length', ek.ek(os.path.getsize, logfile_name))
|
||||||
self.set_header('Content-Disposition', 'attachment; filename=sickgear.log')
|
self.set_header('Content-Disposition', 'attachment; filename=sickgear.log')
|
||||||
with open(logger.current_log_file(), 'r') as logfile:
|
with open(logfile_name, 'r') as logfile:
|
||||||
return logfile.read()
|
try:
|
||||||
|
while True:
|
||||||
|
data = logfile.read(4096)
|
||||||
|
if not data:
|
||||||
|
break
|
||||||
|
self.write(data)
|
||||||
|
self.finish()
|
||||||
|
except (StandardError, Exception):
|
||||||
|
return
|
||||||
|
|
||||||
def viewlog(self, minLevel=logger.MESSAGE, maxLines=500):
|
def viewlog(self, minLevel=logger.MESSAGE, maxLines=500):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue