Create a trace mode for SQL inspection

This commit is contained in:
Reid 'arrdem' McKenzie 2023-06-03 15:14:02 -06:00
parent 1124f9a75b
commit a278047169

View file

@ -103,15 +103,17 @@ def make_app():
@cli.command() @cli.command()
@click.option("--hostname", "hostname", type=str, default="0.0.0.0") @click.option("--hostname", "hostname", type=str, default="0.0.0.0")
@click.option("--port", "port", type=int, default=8080) @click.option("--port", "port", type=int, default=8080)
@click.option("--trace/--no-trace", "trace", default=False)
@click.option("--config", type=Path) @click.option("--config", type=Path)
def serve(hostname: str, port: int, config: Path): def serve(hostname: str, port: int, config: Path, trace: bool):
logging.basicConfig( logging.basicConfig(
format="%(asctime)s %(threadName)s - %(name)s - %(levelname)s - %(message)s", format="%(asctime)s %(threadName)s - %(name)s - %(levelname)s - %(message)s",
level=logging.INFO, level=logging.INFO,
) )
logging.getLogger("tentacles").setLevel(logging.DEBUG) logging.getLogger("tentacles").setLevel(logging.DEBUG)
logging.getLogger("tentacles.db").setLevel(logging.DEBUG - 1) if trace:
logging.getLogger("tentacles.db").setLevel(logging.DEBUG - 1)
app = make_app() app = make_app()