[docs]defconfig_loggers(config):""" Configuration des niveaux de logging/warnings et des hanlers """root_logger=logging.getLogger()formatter=RequestIdFormatter()default_handler.setFormatter(formatter)root_logger.addHandler(default_handler)root_logger.setLevel(config["SERVER"]["LOG_LEVEL"])ifconfig["MAIL_ON_ERROR"]andconfig["MAIL_CONFIG"]:MAIL_CONFIG=config["MAIL_CONFIG"]mail_handler=SMTPHandler(mailhost=(MAIL_CONFIG["MAIL_SERVER"],MAIL_CONFIG["MAIL_PORT"]),fromaddr=MAIL_CONFIG["MAIL_USERNAME"],toaddrs=MAIL_CONFIG["ERROR_MAIL_TO"],subject="GeoNature error",credentials=(MAIL_CONFIG["MAIL_USERNAME"],MAIL_CONFIG["MAIL_PASSWORD"]),secure=(),)mail_handler.setLevel(logging.ERROR)root_logger.addHandler(mail_handler)logging.getLogger("fiona").setLevel(config["SERVER"]["LOG_LEVEL"])ifos.environ.get("FLASK_ENV")=="development":warnings.simplefilter("always",DeprecationWarning)else:gunicorn_error_logger=logging.getLogger("gunicorn.error")root_logger.handlers.extend(gunicorn_error_logger.handlers)