Browse Source

Merge pull request #824 from JackDandy/feature/ChangeDownloadLogStream

Change send download logfile as stream.
pull/825/head
JackDandy 9 years ago
committed by GitHub
parent
commit
a23985514b
  1. 1
      CHANGES.md
  2. 17
      sickbeard/webserve.py

1
CHANGES.md

@ -226,6 +226,7 @@
* Change improve TvChaos item parsing and can use qualities instead of 'Unknown'
* Change remove deprecated providers being saved to config
* 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)

17
sickbeard/webserve.py

@ -5495,10 +5495,21 @@ class ErrorLogs(MainHandler):
self.redirect('/errorlogs/')
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')
with open(logger.current_log_file(), 'r') as logfile:
return logfile.read()
with open(logfile_name, 'r') as logfile:
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):

Loading…
Cancel
Save