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

Commit 997c8ae

Browse files
authored
Merge pull request #478 from stacklok/quiten-logs
Logs are to verbose and make it a challenge to follow
2 parents f6e2937 + d78c8a9 commit 997c8ae

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

src/codegate/codegate_logging.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def setup_logging(
148148
# Set explicitly the log level for other modules
149149
logging.getLogger("sqlalchemy").disabled = True
150150
logging.getLogger("uvicorn.error").disabled = True
151+
logging.getLogger("aiosqlite").disabled = True
151152

152153
# Create a logger for our package
153154
logger = structlog.get_logger("codegate")

src/codegate/db/connection.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ async def record_outputs(self, outputs: List[Output]) -> Optional[Output]:
144144
"""
145145
)
146146
recorded_output = await self._insert_pydantic_model(output_db, sql)
147-
logger.debug(f"Recorded output: {recorded_output}")
147+
# Uncomment to debug
148+
# logger.debug(f"Recorded output: {recorded_output}")
148149
return recorded_output
149150

150151
async def record_alerts(self, alerts: List[Alert]) -> List[Alert]:
@@ -177,8 +178,8 @@ async def record_alerts(self, alerts: List[Alert]) -> List[Alert]:
177178
recorded_alerts.append(alert_result)
178179
if alert_result and alert_result.trigger_category == "critical":
179180
await alert_queue.put(f"New alert detected: {alert.timestamp}")
180-
181-
logger.debug(f"Recorded alerts: {recorded_alerts}")
181+
# Uncomment to debug the recorded alerts
182+
# logger.debug(f"Recorded alerts: {recorded_alerts}")
182183
return recorded_alerts
183184

184185
def _should_record_context(self, context: Optional[PipelineContext]) -> bool:

src/codegate/pipeline/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ def add_alert(
117117
timestamp=datetime.datetime.now(datetime.timezone.utc),
118118
)
119119
)
120-
logger.debug(f"Added alert to context: {self.alerts_raised[-1]}")
120+
# Uncomment the below to debug
121+
# logger.debug(f"Added alert to context: {self.alerts_raised[-1]}")
121122

122123
def add_input_request(
123124
self, normalized_request: ChatCompletionRequest, is_fim_request: bool, provider: str
@@ -159,7 +160,8 @@ def add_output(self, model_response: ModelResponse) -> None:
159160
output=output_str,
160161
)
161162
)
162-
logger.debug(f"Added output to context: {self.output_responses[-1]}")
163+
# Uncomment the below to debug the responses
164+
# logger.debug(f"Added output to context: {self.output_responses[-1]}")
163165
except Exception as e:
164166
logger.error(f"Failed to serialize output: {model_response}", error=str(e))
165167
return

src/codegate/storage/storage_engine.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,15 @@ async def search(
200200

201201
# Log the raw SQL results
202202
rows = cursor.fetchall()
203-
logger.debug(
204-
"Raw SQL results",
205-
row_count=len(rows),
206-
rows=[
207-
{"name": row[0], "type": row[1], "status": row[2], "description": row[3]}
208-
for row in rows
209-
],
210-
)
203+
# Uncomment the following lines to log
204+
# logger.debug(
205+
# "Raw SQL results",
206+
# row_count=len(rows),
207+
# rows=[
208+
# {"name": row[0], "type": row[1], "status": row[2], "description": row[3]}
209+
# for row in rows
210+
# ],
211+
# )
211212

212213
results = []
213214
query_words = None

0 commit comments

Comments
 (0)