Skip to content

fix: replace print() with structured logging in HTTPS server#191

Open
adarshkumar23 wants to merge 1 commit intokubeflow:mainfrom
adarshkumar23:fix/replace-print-with-logging
Open

fix: replace print() with structured logging in HTTPS server#191
adarshkumar23 wants to merge 1 commit intokubeflow:mainfrom
adarshkumar23:fix/replace-print-with-logging

Conversation

@adarshkumar23
Copy link
Copy Markdown

Summary

Replace all raw print() statements in server-https/app.py with Python's logging module using proper log levels and format strings.

Problem

The HTTPS server uses bare print() for all output — errors, info, and debug messages are all treated identically. This makes it impossible to:

  • Filter logs by severity in production
  • Add timestamps for debugging
  • Integrate with log aggregation tools (Fluentd, Loki, CloudWatch)
  • Silence verbose output without losing error visibility

Changes

  • Added logging module with basicConfig (timestamped, leveled format)
  • [ERROR] prints → logger.error()
  • [TOOL] / [CHAT] prints → logger.info()
  • Startup prints → logger.info()
  • Used %s format strings instead of f-strings (logging best practice for lazy evaluation)

Files Changed

  • server-https/app.py — 21 print statements → structured logging

Replace all raw print() statements with Python logging module
using proper log levels (INFO, ERROR) and format strings. This
enables production-grade log management with configurable levels,
timestamps, and integration with log aggregation systems.

Signed-off-by: Adarsh Kumar <adarsh23072005@gmail.com>
Signed-off-by: adarshkumar23 <131923092+adarshkumar23@users.noreply.github.com>
@google-oss-prow
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign franciscojavierarceo for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant