def __init__(self, *args, **kwargs): """ Creates an instance of the IRCNotifyWorker. """ Worker.__init__(self, *args, **kwargs) self.__initial_start = True # Records if we are in the initial start self._irc_comm = Queue() self._irc_resp = Queue() self._irc_client = Process(target=IRCLoop, args=(self._irc_comm, self._irc_resp, self.app_logger, self._config)) self._irc_client.start()
def __init__(self, *args, **kwargs): Worker.__init__(self, *args, **kwargs) # There are no redactions by default self._redaction_rx = None # Attempt to pull redactions from the worker config redaction_cfg = self._config.get('redactions', []) if redaction_cfg: # if redactions exist in the config then build a regex from # the config to use for substitution. redaction_rx_build = '(' for redaction in redaction_cfg: redaction_str = '.*%s[^\\n]*\\n|' % redaction self.app_logger.debug('Adding "%s"' % redaction) redaction_rx_build += redaction_str # Remove the last | and end the regex redaction_rx_build = redaction_rx_build[0:-1] + ')' self._redaction_rx = re.compile(redaction_rx_build) self.app_logger.info('Redactions are turned on.') self.app_logger.debug('Redaction RX: %s' % redaction_rx_build)