Create a trace mode for SQL inspection

This commit is contained in:
Reid 'arrdem' McKenzie 2023-06-03 15:14:02 -06:00
parent 48c30fdcf8
commit 95d67b4aeb

View file

@ -103,14 +103,16 @@ 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)
if trace:
logging.getLogger("tentacles.db").setLevel(logging.DEBUG - 1) logging.getLogger("tentacles.db").setLevel(logging.DEBUG - 1)
app = make_app() app = make_app()