# -*- coding: utf-8 -*-
"""sb-fastapi CLI root."""
import logging

import click
from sb_backend.cli.commands.serve import serve


@click.group()
@click.option(
    "-v",
    "--verbose",
    help="Enable verbose logging.",
    is_flag=True,
    default=False,
)
def cli(**options):
    """sb-fastapi CLI root."""
    if options["verbose"]:
        level = logging.DEBUG
    else:
        level = logging.INFO

    logging.basicConfig(
        level=level,
        format="[%(asctime)s] [%(process)s] [%(levelname)s] %(message)s",
        datefmt="%Y-%m-%d %H:%M:%S %z",
    )


cli.add_command(serve)

[(9, 'click.group', 'click.group', ([], {}), False, 'import click\n'), (10, 'click.option', 'click.option', (['"""-v"""', '"""--verbose"""'], {'help': '"""Enable verbose logging."""', 'is_flag': '(True)', 'default': '(False)'}), False, 'import click\n'), (24, 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'level', 'format': '"""[%(asctime)s] [%(process)s] [%(levelname)s] %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S %z"""'}), False, 'import logging\n')]