|
@ -32,12 +32,11 @@ class Loader(object): |
|
|
from couchpotato.core.logger import CPLog |
|
|
from couchpotato.core.logger import CPLog |
|
|
self.log = CPLog(__name__) |
|
|
self.log = CPLog(__name__) |
|
|
|
|
|
|
|
|
if self.options.daemon: |
|
|
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s', '%H:%M:%S') |
|
|
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s', '%H:%M:%S') |
|
|
hdlr = handlers.RotatingFileHandler(os.path.join(self.data_dir, 'logs', 'error.log'), 'a', 500000, 10) |
|
|
hdlr = handlers.RotatingFileHandler(os.path.join(self.data_dir, 'logs', 'error.log'), 'a', 500000, 10) |
|
|
hdlr.setLevel(logging.CRITICAL) |
|
|
hdlr.setLevel(logging.CRITICAL) |
|
|
hdlr.setFormatter(formatter) |
|
|
hdlr.setFormatter(formatter) |
|
|
self.log.logger.addHandler(hdlr) |
|
|
self.log.logger.addHandler(hdlr) |
|
|
|
|
|
|
|
|
|
|
|
def addSignals(self): |
|
|
def addSignals(self): |
|
|
|
|
|
|
|
@ -61,8 +60,11 @@ class Loader(object): |
|
|
try: |
|
|
try: |
|
|
from couchpotato.runner import runCouchPotato |
|
|
from couchpotato.runner import runCouchPotato |
|
|
runCouchPotato(self.options, base_path, sys.argv[1:]) |
|
|
runCouchPotato(self.options, base_path, sys.argv[1:]) |
|
|
except (KeyboardInterrupt, SystemExit): |
|
|
except KeyboardInterrupt: |
|
|
pass |
|
|
pass |
|
|
|
|
|
except SystemExit, e: |
|
|
|
|
|
if str(e) is '3': |
|
|
|
|
|
raise |
|
|
except: |
|
|
except: |
|
|
self.log.critical(traceback.format_exc()) |
|
|
self.log.critical(traceback.format_exc()) |
|
|
|
|
|
|
|
@ -105,6 +107,6 @@ if __name__ == '__main__': |
|
|
l.daemonize() |
|
|
l.daemonize() |
|
|
l.run() |
|
|
l.run() |
|
|
except SystemExit: |
|
|
except SystemExit: |
|
|
pass |
|
|
raise |
|
|
except: |
|
|
except: |
|
|
l.log.critical(traceback.format_exc()) |
|
|
l.log.critical(traceback.format_exc()) |
|
|