def __init__(self, alert_name): self._alert_name = alert_name # self._logger_name = "modalert_" + alert_name self._logger_name = alert_name + "_modalert" self._logger = Logs().get_logger(self._logger_name) super(ModularAlertBase, self).__init__(sys.stdin.read(), self._logger, alert_name)
def get_logger(name): log_obj = Logs() logger = log_obj.get_logger(name) ch = logging.StreamHandler(sys.stderr) ch.setLevel(logging.DEBUG) formatter = logging.Formatter( "%(asctime)s %(levelname)s pid=%(process)d tid=%(threadName)s " "file=%(filename)s:%(funcName)s:%(lineno)d | %(message)s") ch.setFormatter(formatter) logger.addHandler(ch) return logger
def get_logger(name): return Logs().get_logger(name)