Skip to content

Refactor print() calls to use structured logging (absl.logging) #187

@manaspros

Description

@manaspros

I was reading through the codebase and noticed there are quite a few print() statements scattered throughout (I counted around 200+). While this works for quick debugging, it makes it harder to control output in production environments and doesn't follow Python logging best practices.

Current Issues:

  1. No log level control - Can't filter debug vs info vs warning messages
  2. Hard to debug in production - No timestamps, no module context, no log levels
  3. Inconsistent with project standards - The project already uses absl-py for flags, but logging is inconsistent
  4. Can't redirect or suppress output - Print statements always go to stdout

Examples I Found:

In various files

print(f"Agent {self.name} taking action...")
print("Memory retrieved:", memories)
print(f"Debug: {some_variable}")

Proposed Solution:

Replace print statements with absl.logging (already a dependency) or Python's standard logging module:

from absl import logging

Instead of print

logging.info("Agent %s taking action...", self.name)
logging.debug("Memory retrieved: %s", memories)

I'd be happy to work on this systematically across the codebase. I think it's a good way to get familiar with all the modules while improving code quality.

Would the team be open to this? Happy to start with a small PR on a single module to get feedback on the approach before doing the full refactor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions