from typing import Dict
from typing import Any
import logging


def build_log_config(level: str) -> Dict[str, Any]:
    """Build a log config from a level."""
    return {
        "version": 1,
        "disable_existing_loggers": False,
        "formatters": {
            "basic": {"format": "%(asctime)s %(name)s %(levelname)s %(message)s"}
        },
        "handlers": {
            "stream_handler": {
                "class": "logging.StreamHandler",
                "formatter": "basic",
                "level": getattr(logging, level),
            },
        },
        "loggers": {
            "": {
                "handlers": ["stream_handler"],
                "level": getattr(logging, level),
            },
        },
    }