def setup_logging(): logger = logging.getLogger() for h in logger.handlers: logger.removeHandler(h) h = logging.StreamHandler(sys.stdout) h.setFormatter(cis_logger.JsonFormatter(extra={"hostname": socket.gethostname()})) logger.addHandler(h) logger.setLevel(logging.INFO) return logger
def setup_class(self): self.logger = logging.getLogger() handler = logging.StreamHandler() handler.setFormatter( cis_logger.JsonFormatter(extra={ "hello": "world", "hostname": socket.gethostname() })) self.logger.addHandler(handler) self.logger.setLevel(logging.INFO)
def setup_logging(): logger = logging.getLogger() for h in logger.handlers: logger.removeHandler(h) h = logging.StreamHandler(sys.stdout) h.setFormatter( cis_logger.JsonFormatter(extra={"hostname": socket.gethostname()})) logger.addHandler(h) logger.setLevel(logging.INFO) # Quiet botocore verbose logging... logging.getLogger("botocore").setLevel(logging.WARNING) return logger