Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Silencing SQLAlchemy logs #172

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/codegate/codegate_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ def setup_logging(
root_logger.addHandler(stdout_handler)
root_logger.addHandler(stderr_handler)

# Set explicitly the log level for other modules
logging.getLogger("sqlalchemy").setLevel(logging.WARNING)

# Create a logger for our package
logger = structlog.get_logger("codegate")
logger.debug(
Expand Down
2 changes: 1 addition & 1 deletion src/codegate/db/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, sqlite_path: Optional[str] = None):
logger.debug(f"Initializing DB from path: {self._db_path}")
engine_dict = {
"url": f"sqlite+aiosqlite:///{self._db_path}",
"echo": True, # Set to False in production
"echo": False, # Set to False in production
"isolation_level": "AUTOCOMMIT", # Required for SQLite
}
self._async_db_engine = create_async_engine(**engine_dict)
Expand Down
Loading