Skip to content

Conversation

@subrata-ms
Copy link
Contributor

Work Item / Issue Reference

AB#<WORK_ITEM_ID>

GitHub Issue: #<ISSUE_NUMBER>


Summary

@github-actions
Copy link

📊 Code Coverage Report

🔥 Diff Coverage

31%


🎯 Overall Coverage

76%


📈 Total Lines Covered: 5474 out of 7152
📁 Project: mssql-python


Diff Coverage

Diff: main...HEAD, staged and unstaged changes

  • mssql_python/logging.py (31.8%): Missing lines 150-151,160-161,344-346,349-350,361-362,364-367

Summary

  • Total: 22 lines
  • Missing: 15 lines
  • Coverage: 31%

mssql_python/logging.py

Lines 146-155

  146         class CSVFormatter(logging.Formatter):
  147             def format(self, record):
  148                 # Check if this is from Rust (via rust_log method)
  149                 if hasattr(record, 'funcName') and record.funcName == "rust":
! 150                     source = "Rust"
! 151                     message = record.getMessage()
  152                 else:
  153                     # Extract source from message (e.g., [Python] or [DDBC])
  154                     msg = record.getMessage()
  155                     if msg.startswith("[") and "]" in msg:

Lines 156-165

  156                         end_bracket = msg.index("]")
  157                         source = msg[1:end_bracket]
  158                         message = msg[end_bracket + 2 :].strip()  # Skip '] '
  159                     else:
! 160                         source = "Unknown"
! 161                         message = msg
  162 
  163                 # Format timestamp with milliseconds using period separator
  164                 timestamp = self.formatTime(record, "%Y-%m-%d %H:%M:%S")
  165                 timestamp_with_ms = f"{timestamp}.{int(record.msecs):03d}"

Lines 340-354

  340             msg: Message string (already formatted)
  341             filename: Source filename (e.g., 'cursor.rs')
  342             lineno: Line number in source file
  343         """
! 344         try:
! 345             if not self._logger.isEnabledFor(level):
! 346                 return
  347             
  348             # Create a custom LogRecord with Rust source location
! 349             import logging as log_module
! 350             record = log_module.LogRecord(
  351                 name=self._logger.name,
  352                 level=level,
  353                 pathname=filename,
  354                 lineno=lineno,

Lines 357-371

  357                 exc_info=None,
  358                 func="rust",
  359                 sinfo=None
  360             )
! 361             self._logger.handle(record)
! 362         except Exception:
  363             # Fallback - use regular logging
! 364             try:
! 365                 self._logger.log(level, msg)
! 366             except:
! 367                 pass
  368 
  369     def _log(self, level: int, msg: str, add_prefix: bool = True, *args, **kwargs):
  370         """
  371         Internal logging method with exception safety.


📋 Files Needing Attention

📉 Files with overall lowest coverage (click to expand)
mssql_python.pybind.logger_bridge.hpp: 58.8%
mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.row.py: 66.2%
mssql_python.pybind.ddbc_bindings.cpp: 69.3%
mssql_python.pybind.ddbc_bindings.h: 69.7%
mssql_python.pybind.connection.connection.cpp: 75.3%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 79.6%
mssql_python.logging.py: 81.2%
mssql_python.connection.py: 84.1%

🔗 Quick Links

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant