Skip to content

Conversation

@skmkqw
Copy link

@skmkqw skmkqw commented Apr 3, 2025

Improve Logging and Error Handling Across the Codebase

Summary

This PR enhances logging across multiple modules to improve debugging, monitoring, and error tracking. The changes ensure that log messages provide meaningful context, reduce unnecessary logs, and improve consistency across the codebase.

Changes

Enhanced Logging Structure

  • Standardized logging messages for better readability.
  • Added structured logging with key-value pairs to improve log searchability.

Improved Error Handling

  • More detailed error logs in fetch_live_nodes() to capture HTTP status and exceptions.
  • Added contextual information (e.g., node IPs, API URLs) to logs for easier debugging.
  • Reduced redundant log entries to avoid unnecessary noise.

Performance Optimizations

  • Reduced logging overhead by logging only essential details.
  • Avoided excessive logging inside loops to prevent performance degradation.
  • Used lazy evaluation (exc_info=True for exceptions) to avoid unnecessary string formatting.

Modules Updated

  • logger.py: Standardized and optimized logging configuration.
  • main.py: Improved logs for service startup and graceful shutdown.
  • monitor.py: Enhanced logging for node status updates and availability checks.
  • rest.py: Added informative logs for REST API requests and server lifecycle events.
  • sql.py: Improved error handling when fetching live nodes.

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