mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-03 18:03:37 +00:00
Merge remote-tracking branch 'origin/dev'
This commit is contained in:
commit
72492d859e
3 changed files with 31 additions and 7 deletions
|
@ -60,6 +60,7 @@ from sickbeard import db
|
||||||
from sickbeard.tv import TVShow
|
from sickbeard.tv import TVShow
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
from sickbeard import webserveInit
|
from sickbeard import webserveInit
|
||||||
|
from sickbeard import autoreload_shutdown
|
||||||
from sickbeard.version import SICKBEARD_VERSION
|
from sickbeard.version import SICKBEARD_VERSION
|
||||||
from sickbeard.databases.mainDB import MIN_DB_VERSION
|
from sickbeard.databases.mainDB import MIN_DB_VERSION
|
||||||
from sickbeard.databases.mainDB import MAX_DB_VERSION
|
from sickbeard.databases.mainDB import MAX_DB_VERSION
|
||||||
|
@ -390,7 +391,7 @@ def main():
|
||||||
# autoreload.
|
# autoreload.
|
||||||
if sickbeard.AUTO_UPDATE:
|
if sickbeard.AUTO_UPDATE:
|
||||||
tornado.autoreload.start(io_loop)
|
tornado.autoreload.start(io_loop)
|
||||||
tornado.autoreload.add_reload_hook(sickbeard.autoreload_shutdown)
|
tornado.autoreload.add_reload_hook(autoreload_shutdown)
|
||||||
|
|
||||||
# start IOLoop.
|
# start IOLoop.
|
||||||
io_loop.start()
|
io_loop.start()
|
||||||
|
|
|
@ -71,10 +71,12 @@ class SBRotatingLogHandler(object):
|
||||||
sb_logger = logging.getLogger('sickbeard')
|
sb_logger = logging.getLogger('sickbeard')
|
||||||
sub_logger = logging.getLogger('subliminal')
|
sub_logger = logging.getLogger('subliminal')
|
||||||
imdb_logger = logging.getLogger('imdbpy')
|
imdb_logger = logging.getLogger('imdbpy')
|
||||||
|
tornado_logger = logging.getLogger('tornado')
|
||||||
|
|
||||||
sb_logger.removeHandler(handler)
|
sb_logger.removeHandler(handler)
|
||||||
sub_logger.removeHandler(handler)
|
sub_logger.removeHandler(handler)
|
||||||
imdb_logger.removeHandler(handler)
|
imdb_logger.removeHandler(handler)
|
||||||
|
tornado_logger.removeHandler(handler)
|
||||||
|
|
||||||
handler.flush()
|
handler.flush()
|
||||||
handler.close()
|
handler.close()
|
||||||
|
@ -108,12 +110,16 @@ class SBRotatingLogHandler(object):
|
||||||
{'sickbeard': logging.Formatter('%(asctime)s %(levelname)s::%(message)s', '%H:%M:%S'),
|
{'sickbeard': logging.Formatter('%(asctime)s %(levelname)s::%(message)s', '%H:%M:%S'),
|
||||||
'subliminal': logging.Formatter('%(asctime)s %(levelname)s::SUBLIMINAL :: %(message)s',
|
'subliminal': logging.Formatter('%(asctime)s %(levelname)s::SUBLIMINAL :: %(message)s',
|
||||||
'%H:%M:%S'),
|
'%H:%M:%S'),
|
||||||
'imdbpy': logging.Formatter('%(asctime)s %(levelname)s::IMDBPY :: %(message)s', '%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')
|
||||||
},
|
},
|
||||||
logging.Formatter('%(message)s'), ))
|
logging.Formatter('%(message)s'), ))
|
||||||
|
|
||||||
# add the handler to the root logger
|
# add the handler to the root logger
|
||||||
logging.getLogger('sickbeard').addHandler(console)
|
logging.getLogger('sickbeard').addHandler(console)
|
||||||
|
logging.getLogger('tornado.general').addHandler(console)
|
||||||
|
logging.getLogger('tornado.application').addHandler(console)
|
||||||
logging.getLogger('subliminal').addHandler(console)
|
logging.getLogger('subliminal').addHandler(console)
|
||||||
logging.getLogger('imdbpy').addHandler(console)
|
logging.getLogger('imdbpy').addHandler(console)
|
||||||
|
|
||||||
|
@ -121,12 +127,24 @@ class SBRotatingLogHandler(object):
|
||||||
|
|
||||||
self.cur_handler = self._config_handler()
|
self.cur_handler = self._config_handler()
|
||||||
logging.getLogger('sickbeard').addHandler(self.cur_handler)
|
logging.getLogger('sickbeard').addHandler(self.cur_handler)
|
||||||
|
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('subliminal').addHandler(self.cur_handler)
|
||||||
logging.getLogger('imdbpy').addHandler(self.cur_handler)
|
logging.getLogger('imdbpy').addHandler(self.cur_handler)
|
||||||
|
|
||||||
logging.getLogger('sickbeard').setLevel(DB)
|
logging.getLogger('sickbeard').setLevel(DB)
|
||||||
logging.getLogger('subliminal').setLevel(logging.WARNING)
|
|
||||||
logging.getLogger('imdbpy').setLevel(logging.WARNING)
|
log_level = logging.WARNING
|
||||||
|
if sickbeard.DEBUG:
|
||||||
|
log_level = logging.DEBUG
|
||||||
|
|
||||||
|
logging.getLogger('tornado.general').setLevel(log_level)
|
||||||
|
logging.getLogger('tornado.application').setLevel(log_level)
|
||||||
|
logging.getLogger('subliminal').setLevel(log_level)
|
||||||
|
logging.getLogger('imdbpy').setLevel(log_level)
|
||||||
|
|
||||||
|
# send logging to null
|
||||||
|
logging.getLogger('tornado.access').addHandler(logging.NullHandler())
|
||||||
|
|
||||||
# already logging in new log folder, close the old handler
|
# already logging in new log folder, close the old handler
|
||||||
if old_handler:
|
if old_handler:
|
||||||
|
@ -151,7 +169,9 @@ class SBRotatingLogHandler(object):
|
||||||
{'sickbeard': logging.Formatter('%(asctime)s %(levelname)-8s %(message)s', '%Y-%m-%d %H:%M:%S'),
|
{'sickbeard': logging.Formatter('%(asctime)s %(levelname)-8s %(message)s', '%Y-%m-%d %H:%M:%S'),
|
||||||
'subliminal': logging.Formatter('%(asctime)s %(levelname)-8s SUBLIMINAL :: %(message)s',
|
'subliminal': logging.Formatter('%(asctime)s %(levelname)-8s SUBLIMINAL :: %(message)s',
|
||||||
'%Y-%m-%d %H:%M:%S'),
|
'%Y-%m-%d %H:%M:%S'),
|
||||||
'imdbpy': logging.Formatter('%(asctime)s %(levelname)-8s IMDBPY :: %(message)s', '%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')
|
||||||
},
|
},
|
||||||
logging.Formatter('%(message)s'), ))
|
logging.Formatter('%(message)s'), ))
|
||||||
|
|
||||||
|
@ -184,6 +204,7 @@ class SBRotatingLogHandler(object):
|
||||||
sb_logger = logging.getLogger('sickbeard')
|
sb_logger = logging.getLogger('sickbeard')
|
||||||
sub_logger = logging.getLogger('subliminal')
|
sub_logger = logging.getLogger('subliminal')
|
||||||
imdb_logger = logging.getLogger('imdbpy')
|
imdb_logger = logging.getLogger('imdbpy')
|
||||||
|
tornado_logger = logging.getLogger('tornado')
|
||||||
|
|
||||||
# delete the old handler
|
# delete the old handler
|
||||||
if self.cur_handler:
|
if self.cur_handler:
|
||||||
|
@ -208,6 +229,7 @@ class SBRotatingLogHandler(object):
|
||||||
sb_logger.addHandler(new_file_handler)
|
sb_logger.addHandler(new_file_handler)
|
||||||
sub_logger.addHandler(new_file_handler)
|
sub_logger.addHandler(new_file_handler)
|
||||||
imdb_logger.addHandler(new_file_handler)
|
imdb_logger.addHandler(new_file_handler)
|
||||||
|
tornado_logger.addHandler(new_file_handler)
|
||||||
|
|
||||||
def log(self, toLog, logLevel=MESSAGE):
|
def log(self, toLog, logLevel=MESSAGE):
|
||||||
|
|
||||||
|
@ -231,6 +253,7 @@ class SBRotatingLogHandler(object):
|
||||||
|
|
||||||
sub_logger = logging.getLogger('subliminal')
|
sub_logger = logging.getLogger('subliminal')
|
||||||
imdb_logger = logging.getLogger('imdbpy')
|
imdb_logger = logging.getLogger('imdbpy')
|
||||||
|
tornado_logger = logging.getLogger('tornado')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if logLevel == DEBUG:
|
if logLevel == DEBUG:
|
||||||
|
|
|
@ -4,6 +4,7 @@ import sickbeard
|
||||||
import webserve
|
import webserve
|
||||||
import webapi
|
import webapi
|
||||||
|
|
||||||
|
import tornado.options
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
from sickbeard.helpers import create_https_certificates
|
from sickbeard.helpers import create_https_certificates
|
||||||
from tornado.web import Application, StaticFileHandler, RedirectHandler, HTTPError
|
from tornado.web import Application, StaticFileHandler, RedirectHandler, HTTPError
|
||||||
|
@ -97,8 +98,7 @@ def initWebServer(options={}):
|
||||||
|
|
||||||
# Load the app
|
# Load the app
|
||||||
app = Application([],
|
app = Application([],
|
||||||
log_function=lambda x: None,
|
debug=sickbeard.DEBUG,
|
||||||
debug=False,
|
|
||||||
gzip=True,
|
gzip=True,
|
||||||
autoreload=sickbeard.AUTO_UPDATE,
|
autoreload=sickbeard.AUTO_UPDATE,
|
||||||
xheaders=True,
|
xheaders=True,
|
||||||
|
|
Loading…
Reference in a new issue