Skip to content

Commit 26e307e

Browse files
committed
Remove unused logging
1 parent c94c105 commit 26e307e

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

pymongosql/sql/handler.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"""
55
import logging
66
import re
7-
import time
87
from abc import ABC, abstractmethod
98
from dataclasses import dataclass, field
109
from typing import Any, Dict, List, Optional, Tuple
@@ -140,11 +139,10 @@ def _log_operation_start(self, operation: str, ctx: Any, operation_id: int):
140139
},
141140
)
142141

143-
def _log_operation_success(self, operation: str, operation_id: int, processing_time: float, **extra_data):
142+
def _log_operation_success(self, operation: str, operation_id: int, **extra_data):
144143
"""Log successful operation completion"""
145144
log_data = {
146145
"operation": operation,
147-
"processing_time_ms": processing_time,
148146
"operation_id": operation_id,
149147
}
150148
log_data.update(extra_data)
@@ -155,7 +153,6 @@ def _log_operation_error(
155153
operation: str,
156154
ctx: Any,
157155
operation_id: int,
158-
processing_time: float,
159156
error: Exception,
160157
):
161158
"""Log operation error with context"""
@@ -167,7 +164,6 @@ def _log_operation_error(
167164
"context_text": ContextUtilsMixin.get_context_text(ctx),
168165
"context_type": ContextUtilsMixin.get_context_type_name(ctx),
169166
"operation": operation,
170-
"processing_time_ms": processing_time,
171167
"operation_id": operation_id,
172168
},
173169
exc_info=True,
@@ -270,7 +266,6 @@ def can_handle(self, ctx: Any) -> bool:
270266

271267
def handle_expression(self, ctx: Any) -> ParseResult:
272268
"""Convert comparison expression to MongoDB filter"""
273-
start_time = time.time()
274269
operation_id = id(ctx)
275270
self._log_operation_start("comparison_parsing", ctx, operation_id)
276271

@@ -281,20 +276,17 @@ def handle_expression(self, ctx: Any) -> ParseResult:
281276

282277
mongo_filter = self._build_mongo_filter(field_name, operator, value)
283278

284-
processing_time = (time.time() - start_time) * 1000
285279
self._log_operation_success(
286280
"comparison_parsing",
287281
operation_id,
288-
processing_time,
289282
field_name=field_name,
290283
operator=operator,
291284
)
292285

293286
return ParseResult(filter_conditions=mongo_filter)
294287

295288
except Exception as e:
296-
processing_time = (time.time() - start_time) * 1000
297-
self._log_operation_error("comparison_parsing", ctx, operation_id, processing_time, e)
289+
self._log_operation_error("comparison_parsing", ctx, operation_id, e)
298290
return ParseResult(has_errors=True, error_message=str(e))
299291

300292
def _build_mongo_filter(self, field_name: str, operator: str, value: Any) -> Dict[str, Any]:
@@ -572,7 +564,6 @@ def _is_logical_context(self, ctx: Any) -> bool:
572564

573565
def handle_expression(self, ctx: Any) -> ParseResult:
574566
"""Convert logical expression to MongoDB filter"""
575-
start_time = time.time()
576567
operation_id = id(ctx)
577568
self._log_operation_start("logical_parsing", ctx, operation_id)
578569

@@ -589,20 +580,17 @@ def handle_expression(self, ctx: Any) -> ParseResult:
589580
# Combine operands based on logical operator
590581
mongo_filter = self._combine_operands(operator, processed_operands)
591582

592-
processing_time = (time.time() - start_time) * 1000
593583
self._log_operation_success(
594584
"logical_parsing",
595585
operation_id,
596-
processing_time,
597586
operator=operator,
598587
processed_count=len(processed_operands),
599588
)
600589

601590
return ParseResult(filter_conditions=mongo_filter)
602591

603592
except Exception as e:
604-
processing_time = (time.time() - start_time) * 1000
605-
self._log_operation_error("logical_parsing", ctx, operation_id, processing_time, e)
593+
self._log_operation_error("logical_parsing", ctx, operation_id, e)
606594
return ParseResult(has_errors=True, error_message=str(e))
607595

608596
def _process_operands(self, operands: List[Any]) -> List[Dict[str, Any]]:
@@ -759,7 +747,6 @@ def can_handle(self, ctx: Any) -> bool:
759747

760748
def handle_expression(self, ctx: Any) -> ParseResult:
761749
"""Handle function expressions"""
762-
start_time = time.time()
763750
operation_id = id(ctx)
764751
self._log_operation_start("function_parsing", ctx, operation_id)
765752

@@ -770,19 +757,16 @@ def handle_expression(self, ctx: Any) -> ParseResult:
770757
# For now, just return a placeholder - this would need full implementation
771758
mongo_filter = {"$expr": {self.FUNCTION_MAP.get(function_name.upper(), "$sum"): arguments}}
772759

773-
processing_time = (time.time() - start_time) * 1000
774760
self._log_operation_success(
775761
"function_parsing",
776762
operation_id,
777-
processing_time,
778763
function_name=function_name,
779764
)
780765

781766
return ParseResult(filter_conditions=mongo_filter)
782767

783768
except Exception as e:
784-
processing_time = (time.time() - start_time) * 1000
785-
self._log_operation_error("function_parsing", ctx, operation_id, processing_time, e)
769+
self._log_operation_error("function_parsing", ctx, operation_id, e)
786770
return ParseResult(has_errors=True, error_message=str(e))
787771

788772
def _is_function_context(self, ctx: Any) -> bool:

0 commit comments

Comments
 (0)