diff --git a/gamebrain/app.py b/gamebrain/app.py index 1e0f2ea..65ec01d 100644 --- a/gamebrain/app.py +++ b/gamebrain/app.py @@ -357,10 +357,14 @@ async def gamestate_get_is_team_active( async def get_is_team_active( team_id: str ) -> GenericResponse: + from util import enable_sql_logger, disable_sql_logger + + enable_sql_logger() active_teams = { team["id"] for team in await db.get_active_teams() } + disable_sql_logger() response = GenericResponse( success=(team_id in active_teams), message=team_id diff --git a/gamebrain/util.py b/gamebrain/util.py index 0650e65..e0c6b7c 100644 --- a/gamebrain/util.py +++ b/gamebrain/util.py @@ -145,3 +145,15 @@ async def cleanup_dead_sessions(nuke: bool = False): async def nuke_active_sessions(): await cleanup_dead_sessions(True) + + +async def set_sql_logger(level): + logging.getLogger("sqlalchemy.engine").setLevel() + + +async def enable_sql_logger(): + await set_sql_logger(logging.INFO) + + +async def disable_sql_logger(): + await set_sql_logger(logging.NOTSET)