mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 19:12:26 -05:00
Fix for feedcache logging.
Fix for adding new and existing shows. Fix for static content.
This commit is contained in:
parent
fd88c77d26
commit
0e962f83cb
@ -97,18 +97,8 @@ def change_LOG_DIR(log_dir, web_log):
|
||||
return False
|
||||
|
||||
if sickbeard.WEB_LOG != web_log_value or log_dir_changed == True:
|
||||
|
||||
sickbeard.WEB_LOG = web_log_value
|
||||
|
||||
if sickbeard.WEB_LOG:
|
||||
cherry_log = os.path.join(sickbeard.LOG_DIR, "cherrypy.log")
|
||||
logger.log(u"Change cherry log file to " + cherry_log)
|
||||
else:
|
||||
cherry_log = None
|
||||
logger.log(u"Disable cherry logging")
|
||||
|
||||
#cherrypy.config.update({'log.access_file': cherry_log})
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
@ -76,11 +76,13 @@ class SBRotatingLogHandler(object):
|
||||
sub_logger = logging.getLogger('subliminal')
|
||||
imdb_logger = logging.getLogger('imdbpy')
|
||||
tornado_logger = logging.getLogger('tornado')
|
||||
feedcache_logger = logging.getLogger('feedcache')
|
||||
|
||||
sb_logger.removeHandler(handler)
|
||||
sub_logger.removeHandler(handler)
|
||||
imdb_logger.removeHandler(handler)
|
||||
tornado_logger.removeHandler(handler)
|
||||
feedcache_logger.removeHandler(handler)
|
||||
|
||||
handler.flush()
|
||||
handler.close()
|
||||
@ -116,7 +118,9 @@ class SBRotatingLogHandler(object):
|
||||
'%H:%M:%S'),
|
||||
'imdbpy': logging.Formatter('%(asctime)s %(levelname)s::IMDBPY :: %(message)s', '%H:%M:%S'),
|
||||
'tornado.general': logging.Formatter('%(asctime)s %(levelname)s::TORNADO :: %(message)s', '%H:%M:%S'),
|
||||
'tornado.application': logging.Formatter('%(asctime)s %(levelname)s::TORNADO :: %(message)s', '%H:%M:%S')
|
||||
'tornado.application': logging.Formatter('%(asctime)s %(levelname)s::TORNADO :: %(message)s', '%H:%M:%S'),
|
||||
'feedcache.cache': logging.Formatter('%(asctime)s %(levelname)s::FEEDCACHE :: %(message)s',
|
||||
'%H:%M:%S')
|
||||
},
|
||||
logging.Formatter('%(message)s'), ))
|
||||
|
||||
@ -126,15 +130,18 @@ class SBRotatingLogHandler(object):
|
||||
logging.getLogger('tornado.application').addHandler(console)
|
||||
logging.getLogger('subliminal').addHandler(console)
|
||||
logging.getLogger('imdbpy').addHandler(console)
|
||||
logging.getLogger('feedcache').addHandler(console)
|
||||
|
||||
self.log_file_path = os.path.join(sickbeard.LOG_DIR, self.log_file)
|
||||
|
||||
self.cur_handler = self._config_handler()
|
||||
logging.getLogger('sickbeard').addHandler(self.cur_handler)
|
||||
logging.getLogger('tornado.access').addHandler(NullHandler())
|
||||
logging.getLogger('tornado.general').addHandler(self.cur_handler)
|
||||
logging.getLogger('tornado.application').addHandler(self.cur_handler)
|
||||
logging.getLogger('subliminal').addHandler(self.cur_handler)
|
||||
logging.getLogger('imdbpy').addHandler(self.cur_handler)
|
||||
logging.getLogger('feedcache').addHandler(self.cur_handler)
|
||||
|
||||
logging.getLogger('sickbeard').setLevel(DB)
|
||||
|
||||
@ -146,20 +153,20 @@ class SBRotatingLogHandler(object):
|
||||
logging.getLogger('tornado.application').setLevel(log_level)
|
||||
logging.getLogger('subliminal').setLevel(log_level)
|
||||
logging.getLogger('imdbpy').setLevel(log_level)
|
||||
logging.getLogger('feedcache').setLevel(log_level)
|
||||
|
||||
logging.getLogger('tornado.access').addHandler(NullHandler())
|
||||
|
||||
# already logging in new log folder, close the old handler
|
||||
if old_handler:
|
||||
self.close_log(old_handler)
|
||||
# old_handler.flush()
|
||||
# old_handler.close()
|
||||
# sb_logger = logging.getLogger('sickbeard')
|
||||
# sub_logger = logging.getLogger('subliminal')
|
||||
# imdb_logger = logging.getLogger('imdbpy')
|
||||
# sb_logger.removeHandler(old_handler)
|
||||
# subli_logger.removeHandler(old_handler)
|
||||
# imdb_logger.removeHandler(old_handler)
|
||||
# old_handler.flush()
|
||||
# old_handler.close()
|
||||
# sb_logger = logging.getLogger('sickbeard')
|
||||
# sub_logger = logging.getLogger('subliminal')
|
||||
# imdb_logger = logging.getLogger('imdbpy')
|
||||
# sb_logger.removeHandler(old_handler)
|
||||
# subli_logger.removeHandler(old_handler)
|
||||
# imdb_logger.removeHandler(old_handler)
|
||||
|
||||
def _config_handler(self):
|
||||
"""
|
||||
@ -174,7 +181,9 @@ class SBRotatingLogHandler(object):
|
||||
'%Y-%m-%d %H:%M:%S'),
|
||||
'imdbpy': logging.Formatter('%(asctime)s %(levelname)-8s IMDBPY :: %(message)s', '%Y-%m-%d %H:%M:%S'),
|
||||
'tornado.general': logging.Formatter('%(asctime)s %(levelname)-8s TORNADO :: %(message)s', '%Y-%m-%d %H:%M:%S'),
|
||||
'tornado.application': logging.Formatter('%(asctime)s %(levelname)-8s TORNADO :: %(message)s', '%Y-%m-%d %H:%M:%S')
|
||||
'tornado.application': logging.Formatter('%(asctime)s %(levelname)-8s TORNADO :: %(message)s', '%Y-%m-%d %H:%M:%S'),
|
||||
'feedcache.cache': logging.Formatter('%(asctime)s %(levelname)-8s FEEDCACHE :: %(message)s',
|
||||
'%Y-%m-%d %H:%M:%S')
|
||||
},
|
||||
logging.Formatter('%(message)s'), ))
|
||||
|
||||
@ -208,6 +217,7 @@ class SBRotatingLogHandler(object):
|
||||
sub_logger = logging.getLogger('subliminal')
|
||||
imdb_logger = logging.getLogger('imdbpy')
|
||||
tornado_logger = logging.getLogger('tornado')
|
||||
feedcache_logger = logging.getLogger('feedcache')
|
||||
|
||||
# delete the old handler
|
||||
if self.cur_handler:
|
||||
@ -233,6 +243,7 @@ class SBRotatingLogHandler(object):
|
||||
sub_logger.addHandler(new_file_handler)
|
||||
imdb_logger.addHandler(new_file_handler)
|
||||
tornado_logger.addHandler(new_file_handler)
|
||||
feedcache_logger.addHandler(new_file_handler)
|
||||
|
||||
def log(self, toLog, logLevel=MESSAGE):
|
||||
|
||||
@ -257,6 +268,7 @@ class SBRotatingLogHandler(object):
|
||||
sub_logger = logging.getLogger('subliminal')
|
||||
imdb_logger = logging.getLogger('imdbpy')
|
||||
tornado_logger = logging.getLogger('tornado')
|
||||
feedcache_logger = logging.getLogger('feedcache')
|
||||
|
||||
try:
|
||||
if logLevel == DEBUG:
|
||||
|
@ -160,7 +160,6 @@ class Api(webserve.IndexHandler):
|
||||
return webserve._munge(t)
|
||||
|
||||
def _out_as_json(self, dict):
|
||||
""" set cherrypy response to json """
|
||||
self.set_header("Content-Type", "application/json")
|
||||
try:
|
||||
out = json.dumps(dict, indent=self.intent, sort_keys=True)
|
||||
|
@ -80,20 +80,17 @@ except ImportError:
|
||||
from lib import adba
|
||||
|
||||
from Cheetah.Template import Template
|
||||
from tornado import gen, autoreload
|
||||
from tornado.web import RequestHandler, RedirectHandler, HTTPError, asynchronous
|
||||
from tornado.ioloop import IOLoop
|
||||
from tornado import gen
|
||||
from tornado.web import RequestHandler, HTTPError, asynchronous
|
||||
|
||||
# def _handle_reverse_proxy():
|
||||
# if sickbeard.HANDLE_REVERSE_PROXY:
|
||||
# cherrypy.lib.cptools.proxy()
|
||||
|
||||
|
||||
# cherrypy.tools.handle_reverse_proxy = cherrypy.Tool('before_handler', _handle_reverse_proxy)
|
||||
|
||||
req_headers = None
|
||||
|
||||
|
||||
def authenticated(handler_class):
|
||||
def wrap_execute(handler_execute):
|
||||
def basicauth(handler, transforms, *args, **kwargs):
|
||||
@ -226,11 +223,8 @@ class IndexHandler(RequestHandler):
|
||||
response = yield gen.Task(self.getresponse, self._dispatch)
|
||||
self.finish(response)
|
||||
|
||||
@asynchronous
|
||||
@gen.engine
|
||||
def post(self, *args, **kwargs):
|
||||
response = yield gen.Task(self.getresponse, self._dispatch)
|
||||
self.finish(response)
|
||||
return self._dispatch()
|
||||
|
||||
def getresponse(self, func, callback):
|
||||
response = func()
|
||||
@ -2713,7 +2707,7 @@ class NewHomeAddShows(IndexHandler):
|
||||
def finishAddShow():
|
||||
# if there are no extra shows then go home
|
||||
if not other_shows:
|
||||
self.redirect('/home/')
|
||||
return self.redirect('/home/')
|
||||
|
||||
# peel off the next one
|
||||
next_show_dir = other_shows[0]
|
||||
|
@ -12,9 +12,11 @@ from tornado.ioloop import IOLoop
|
||||
|
||||
server = None
|
||||
|
||||
|
||||
class MultiStaticFileHandler(StaticFileHandler):
|
||||
def initialize(self, paths, default_filename=None):
|
||||
self.paths = paths
|
||||
self.default_filename = default_filename
|
||||
|
||||
def get(self, path, include_body=True):
|
||||
for p in self.paths:
|
||||
|
Loading…
Reference in New Issue
Block a user