Skip to content

Conversation

@manaspros
Copy link
Contributor

Fixes #187

This PR replaces all print() calls in the concordia package with proper structured logging using absl.logging, which is already a project dependency.

Benefits

  • Better control over log levels (info, debug, warning, error)
  • Timestamps and module context in log output
  • Ability to filter/suppress output programmatically
  • Consistent logging approach across the codebase

Changes

  • Added from absl import logging imports where needed
  • Replaced print() with appropriate logging levels:
    • logging.info() for informational output
    • logging.debug() for verbose/debug output
    • logging.warning() for warnings
    • logging.error() for error conditions
  • Used %s formatting style for better performance
  • Preserved termcolor.colored() calls for colored output

Files Modified

  • Core engine files (sequential.py, simultaneous.py, parallel_questionnaire.py, sequential_questionnaire.py)
  • Game master components (next_acting.py, scene_tracker.py, questionnaire.py, open_ended_questionnaire.py, payoff_matrix.py, inventory.py)
  • Language model implementations (6 files in contrib/language_models/)
  • Utilities (profiler.py with 38 statements, helper_functions.py, thought_chains.py, call_limit_wrapper.py)
  • Simulation prefabs (generic.py, questionnaire_simulation.py)
  • Environment configuration and scene runners
  • Agent implementations
  • All contrib and deprecated components (46+ files)

Testing

  • ✅ All 144 tests pass with no new failures
  • ✅ Verified 0 print() statements remain in concordia/ package (examples/ excluded as per maintainer guidance)

Total Impact

  • 71 files modified
  • 256 print() statements replaced

Copy link
Collaborator

@locross93 locross93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this @manaspros! The migration to absl.logging looks useful and good to provide better logging control.

Requested changes:

Please remove changes to all files under deprecated/ paths. We are in the process of removing these deprecated components from the codebase, so making changes to them creates unnecessary churn.

Once these files are removed from the PR, I'm happy to approve!

@manaspros
Copy link
Contributor Author

@locross93 Check and let me know

manaspros and others added 7 commits January 26, 2026 22:16
Fixes google-deepmind#187

This PR replaces all print() calls in the concordia package with proper
structured logging using absl.logging, which is already a project dependency.

This provides:
- Better control over log levels (info, debug, warning, error)
- Timestamps and module context in log output
- Ability to filter/suppress output programmatically
- Consistent logging approach across the codebase

Changes:
- Added 'from absl import logging' imports where needed
- Replaced print() with appropriate logging levels:
  - logging.info() for informational output
  - logging.debug() for verbose/debug output
  - logging.warning() for warnings
  - logging.error() for error conditions
- Used %s formatting style for better performance
- Preserved termcolor.colored() calls for colored output

Files modified include:
- Core engine files (sequential.py, simultaneous.py, etc.)
- Game master components
- Language model implementations
- Utilities (profiler.py with 38 statements, helper_functions.py, etc.)
- Simulation prefabs
- All contrib and deprecated components

Testing:
- All 144 tests pass
- Verified 0 print() statements remain in concordia/ package
Remove unnecessary absl.logging import that was conflicting with
standard library logging module. This file uses logging.getLogger()
which is not available in absl.logging.
Use alias 'absl_logging' for absl.logging to avoid conflict with
concordia.typing.logging module which defines LoggingChannel types.
@manaspros manaspros force-pushed the fix/replace-print-with-logging branch from 5b589d6 to a17e192 Compare January 26, 2026 16:51
@manaspros
Copy link
Contributor Author

Sorry for so many commits changes

@manaspros
Copy link
Contributor Author

Should i also remove concordia/components/agents/depreciated? @locross93

@locross93 locross93 self-requested a review January 26, 2026 17:15
@locross93
Copy link
Collaborator

Remove any changes you made to concordia/components/agents/depreciated but don't remove the path if that is what you meant

@manaspros
Copy link
Contributor Author

Now everything is done u can merge

@locross93
Copy link
Collaborator

We got this error on our end preventing a merge: error: Error moving 'release/CHEATSHEET.md'. It doesn't exist in the workdir

Can you make sure your code is up to date with the latest changes.

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.

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

2 participants