Skip to content

fix: replace print() with logger.error() in analytics service - #2

Open
DivyashreeR008 wants to merge 2 commits into
mainfrom
fix/analytics-print-to-logger
Open

fix: replace print() with logger.error() in analytics service#2
DivyashreeR008 wants to merge 2 commits into
mainfrom
fix/analytics-print-to-logger

Conversation

@DivyashreeR008

Copy link
Copy Markdown
Owner

Summary

Replaced print() with logger.error() in the analytics service's production code to use structured logging through the observability pipeline.

Changes

  • File: services/analytics-python-service/main.py:97n- **Before**: print(f"Error creating engine: {e}")n- After: logger.error("analytics.engine_creation_failed", extra={"error": str(e)})`n

Impact

  • Log output is now structured JSON
  • Logs can be filtered by log level (ERROR)
  • Logs pass through the atlas_observability logging middleware
  • Logs are properly captured by log aggregation tools like Loki
  • Uses the already-configured logger instance

Closes Senthil455#66

The analytics service used print() instead of a proper logger when
database engine creation failed. This bypassed structured logging,
log levels, and the observability pipeline.

Changes:
- Replaced print() with logger.error() using structured logging format

This ensures:
- Log output is structured JSON
- Logs can be filtered by log level
- Logs pass through atlas_observability logging middleware
- Logs are captured by log aggregation tools like Loki
DivyashreeR008 pushed a commit that referenced this pull request Jun 17, 2026
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.

MEDIUM: Analytics service uses print() instead of logger in production code

1 participant