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
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
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