mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Merge pull request #824 from JackDandy/feature/ChangeDownloadLogStream
Change send download logfile as stream.
This commit is contained in:
commit
a23985514b
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 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)
|
||||
|
|
|
@ -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…
Reference in a new issue