def __init__(self, parent): self.flow_matchmaker = {} self.global_flow_lock = threading.RLock() self.parent = parent self.config = self.parent.config if self.config.logging: self.log = PcapLogger(self.config.pcap_logdir) task = util.ThreadLauncher(self.flow_printer, parent.handle_control_c, respawn=True) task.start()
def init_logging(self): "Setup all logging for the client" global log rootlogger = logging.getLogger() if not self.config.quiet: output = logging.StreamHandler(sys.stdout) rootlogger.addHandler(output) # now remove the temporary stderr output we were using during startup log.removeHandler(startup_handler) log = rootlogger if self.config.logfile not in ("-", None): fileout = logging.FileHandler(self.config.logfile) rootlogger.addHandler(fileout) log.error("Logging events to " + self.config.logfile) if self.config.pcap_logdir not in ("-", None): self.pcap_logger = PcapLogger(self.config.pcap_logdir) else: self.pcap_logger = None