def log(self, msg, level=INFO, *args, **kwargs): meThread = threading.currentThread().getName() message = meThread + u" :: " + msg # Change the SSL error to a warning with a link to information about how to fix it. check = re.sub( r'error \[Errno 1\] _ssl.c:\d{3}: error:\d{8}:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error', 'See: http://git.io/vJrkM', message) if check is not message: message = check level = WARNING #Avoid open issues when user only need to clear cache to fix issue if re.search(r"_mako\'$", message): #'C__SickRage_gui_slick_views_schedule_mako' #'_usr_local_sickrage_var_SickRage_gui_slick_views_schedule_mako' #'_volume1___plugins_AppCentral_sickbeard_tvrage_SickBeard_TVRage_gui_slick_views_schedule_mako' message = 'Please stop SickRage and delete \SickRage\cache\mako folder. You can see cache folder location in SickRage Help&Info menu' level = WARNING if level == ERROR: self.logger.exception(message, *args, **kwargs) classes.ErrorViewer.add(classes.UIError(message)) elif level == WARNING: self.logger.exception(message, *args, **kwargs) classes.WarningViewer.add(classes.UIError(message)) # if sickbeard.GIT_AUTOISSUES: # self.submit_errors() else: self.logger.log(level, message, *args, **kwargs)
def log(self, msg, level=INFO, *args, **kwargs): meThread = threading.currentThread().getName() if sickbeard.CUR_COMMIT_HASH and len( sickbeard.CUR_COMMIT_HASH) > 6 and level in [ERROR, WARNING]: msg += ' [%s]' % sickbeard.CUR_COMMIT_HASH[:7] message = meThread + u" :: " + msg # Change the SSL error to a warning with a link to information about how to fix it. check = re.sub( ur'error \[Errno 1\] _ssl.c:\d{3}: error:\d{8}:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error', 'See: http://git.io/vJrkM', message) if check is not message: message = check level = WARNING if level == ERROR: classes.ErrorViewer.add(classes.UIError(message)) elif level == WARNING: classes.WarningViewer.add(classes.UIError(message)) # if sickbeard.GIT_AUTOISSUES: # self.submit_errors() if level == ERROR: self.logger.exception(message, *args, **kwargs) else: self.logger.log(level, message, *args, **kwargs)
def log(self, to_log, log_level=MESSAGE): with self.log_lock: out_line = '%s :: %s' % (threading.currentThread().getName(), to_log) sb_logger = logging.getLogger('sickbeard') setattr(sb_logger, 'db', lambda *args: sb_logger.log(DB, *args)) # sub_logger = logging.getLogger('subliminal') # imdb_logger = logging.getLogger('imdbpy') # tornado_logger = logging.getLogger('tornado') try: if DEBUG == log_level: sb_logger.debug(out_line) elif MESSAGE == log_level: sb_logger.info(out_line) elif WARNING == log_level: sb_logger.warning(out_line) elif ERROR == log_level: sb_logger.error(out_line) # add errors to the UI logger classes.ErrorViewer.add(classes.UIError(out_line)) elif DB == log_level: sb_logger.db(out_line) else: sb_logger.log(log_level, out_line) except ValueError: pass
def log(self, toLog, logLevel=MESSAGE): with self.log_lock: # check the size and see if we need to rotate if self.writes_since_check >= 10: if os.path.isfile(self.log_file) and os.path.getsize(self.log_file) >= LOG_SIZE: self._rotate_logs() self.writes_since_check = 0 else: self.writes_since_check += 1 meThread = threading.currentThread().getName() message = meThread + u" :: " + toLog out_line = message.encode('utf-8') sb_logger = logging.getLogger('sickbeard') try: if logLevel == DEBUG: sb_logger.debug(out_line) elif logLevel == MESSAGE: sb_logger.info(out_line) elif logLevel == WARNING: sb_logger.warning(out_line) elif logLevel == ERROR: sb_logger.error(out_line) # add errors to the UI logger classes.ErrorViewer.add(classes.UIError(message)) else: sb_logger.log(logLevel, out_line) except ValueError: pass
def log(self, msg, level=INFO, *args, **kwargs): meThread = threading.currentThread().getName() message = uu(meThread + "::" + msg) if level in (ERROR, WARNING): self.logger.exception(message, *args, **kwargs) if level == ERROR: classes.ErrorViewer.add(classes.UIError(message)) elif level == WARNING: classes.WarningViewer.add(classes.UIError(message)) # if sickbeard.GIT_AUTOISSUES: # self.submit_errors() else: self.logger.log(level, message, *args, **kwargs)
def log(toLog, logLevel=MESSAGE): with log_lock: meThread = threading.currentThread().getName() message = meThread + u" :: " + toLog outLine = message.encode('utf-8') sbLogger = logging.getLogger('sickbeard') try: if logLevel == DEBUG: sbLogger.debug(outLine) elif logLevel == MESSAGE: sbLogger.info(outLine) elif logLevel == WARNING: sbLogger.warning(outLine) elif logLevel == ERROR: sbLogger.error(outLine) # add errors to the UI logger classes.ErrorViewer.add(classes.UIError(message)) else: sbLogger.log(logLevel, outLine) except ValueError, e: pass
def log(self, toLog, logLevel=MESSAGE): with self.log_lock: meThread = threading.currentThread().getName() message = meThread + u" :: " + toLog out_line = message sb_logger = logging.getLogger('sickbeard') setattr(sb_logger, 'db', lambda *args: sb_logger.log(DB, *args)) sub_logger = logging.getLogger('subliminal') imdb_logger = logging.getLogger('imdbpy') tornado_logger = logging.getLogger('tornado') feedcache_logger = logging.getLogger('feedcache') try: if logLevel == DEBUG: sb_logger.debug(out_line) elif logLevel == MESSAGE: sb_logger.info(out_line) elif logLevel == WARNING: sb_logger.warning(out_line) elif logLevel == ERROR: sb_logger.error(out_line) # add errors to the UI logger classes.ErrorViewer.add(classes.UIError(message)) elif logLevel == DB: sb_logger.db(out_line) else: sb_logger.log(logLevel, out_line) except ValueError: pass
def log(self, msg, level=INFO, *args, **kwargs): """ Create log entry :param msg: to log :param level: of log, e.g. DEBUG, INFO, etc. :param args: to pass to logger :param kwargs: to pass to logger """ cur_thread = threading.currentThread().getName() cur_hash = '' if level == ERROR and sickbeard.CUR_COMMIT_HASH and len( sickbeard.CUR_COMMIT_HASH) > 6: cur_hash = '[{0}] '.format(sickbeard.CUR_COMMIT_HASH[:7]) message = '{thread} :: {hash}{message}'.format(thread=cur_thread, hash=cur_hash, message=msg) # Change the SSL error to a warning with a link to information about how to fix it. # Check for 'error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)' ssl_errors = [ r'error \[Errno \d+\] _ssl.c:\d+: error:\d+\s*:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error', r'error \[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE\] sslv3 alert handshake failure \(_ssl\.c:\d+\)', ] for ssl_error in ssl_errors: check = re.sub(ssl_error, 'See: http://git.io/vuU5V', message) if check != message: message = check level = WARNING if level == ERROR: classes.ErrorViewer.add(classes.UIError(message)) elif level == WARNING: classes.WarningViewer.add(classes.UIError(message)) try: if level == ERROR: self.logger.exception(message, *args, **kwargs) else: self.logger.log(level, message, *args, **kwargs) except Exception: if msg and msg.strip( ): # Otherwise creates empty messages in log... print(msg.strip())
def log(self, msg, level=INFO, *args, **kwargs): meThread = threading.currentThread().getName() message = meThread + u" :: " + msg # pass exception information if debugging enabled if level == ERROR: self.logger.exception(message, *args, **kwargs) classes.ErrorViewer.add(classes.UIError(message)) elif level == WARNING: self.logger.exception(message, *args, **kwargs) classes.WarningViewer.add(classes.UIError(message)) # if sickbeard.GIT_AUTOISSUES: # self.submit_errors() else: self.logger.log(level, message, *args, **kwargs)
def log(self, msg, level=INFO, *args, **kwargs): meThread = threading.currentThread().getName() message = meThread + u" :: " + msg # pass exception information if debugging enabled if level == ERROR: kwargs["exc_info"] = 1 classes.ErrorViewer.add(classes.UIError(message)) self.logger.log(level, message, *args, **kwargs)
def log(self, msg, level=INFO, *args, **kwargs): """ Create log entry :param msg: to log :param level: of log, e.g. DEBUG, INFO, etc. :param args: to pass to logger :param kwargs: to pass to logger """ cur_thread = threading.currentThread().getName() if sickbeard.CUR_COMMIT_HASH and len( sickbeard.CUR_COMMIT_HASH) > 6 and level in [ERROR, WARNING]: msg += ' [%s]' % sickbeard.CUR_COMMIT_HASH[:7] message = '%s :: %s' % (cur_thread, msg) # Change the SSL error to a warning with a link to information about how to fix it. # Check for u'error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)' ssl_errors = [ r'error \[Errno \d+\] _ssl.c:\d+: error:\d+\s*:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error', r'error \[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE\] sslv3 alert handshake failure \(_ssl\.c:\d+\)', ] for ssl_error in ssl_errors: check = re.sub(ssl_error, 'See: http://git.io/vuU5V', message) if check != message: message = check level = WARNING if level == ERROR: classes.ErrorViewer.add(classes.UIError(message)) elif level == WARNING: classes.WarningViewer.add(classes.UIError(message)) if level == ERROR: self.logger.exception(message, *args, **kwargs) else: self.logger.log(level, message, *args, **kwargs)
def log(self, msg, level=INFO, *args, **kwargs): meThread = threading.currentThread().getName() message = meThread + u" :: " + msg # pass exception information if debugging enabled if level == ERROR: #Replace the SSL error with a link to information about how to fix it. message = re.sub(r'error \[Errno 1\] _ssl.c:\d{3}: error:\d{8}:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error', r'See: http://git.io/vJrkM', message) self.logger.exception(message, *args, **kwargs) classes.ErrorViewer.add(classes.UIError(message)) # if sickbeard.GIT_AUTOISSUES: # self.submit_errors() else: self.logger.log(level, message, *args, **kwargs)
def log(self, toLog, logLevel=MESSAGE): with self.log_lock: # check the size and see if we need to rotate if self.writes_since_check >= 10: if os.path.isfile(self.log_file_path) and os.path.getsize( self.log_file_path) >= LOG_SIZE: self._rotate_logs() self.writes_since_check = 0 else: self.writes_since_check += 1 meThread = threading.currentThread().getName() message = meThread + u" :: " + toLog out_line = message sb_logger = logging.getLogger('sickbeard') setattr(sb_logger, 'db', lambda *args: sb_logger.log(DB, *args)) sub_logger = logging.getLogger('subliminal') imdb_logger = logging.getLogger('imdbpy') tornado_logger = logging.getLogger('tornado') feedcache_logger = logging.getLogger('feedcache') try: if logLevel == DEBUG: sb_logger.debug(out_line) elif logLevel == MESSAGE: sb_logger.info(out_line) elif logLevel == WARNING: sb_logger.warning(out_line) elif logLevel == ERROR: sb_logger.error(out_line) # add errors to the UI logger classes.ErrorViewer.add(classes.UIError(message)) elif logLevel == DB: sb_logger.db(out_line) else: sb_logger.log(logLevel, out_line) except ValueError: pass
def warning(self, msg, *args, **kwargs): super(CustomLogger, self).exception(msg, *args, **kwargs) classes.WarningViewer.add(classes.UIError(msg))