Skip to content

Add centralized structured logging#68

Merged
gkamradt merged 1 commit into
mainfrom
feature/structured-logging
Jan 15, 2026
Merged

Add centralized structured logging#68
gkamradt merged 1 commit into
mainfrom
feature/structured-logging

Conversation

@ericc59
Copy link
Copy Markdown
Contributor

@ericc59 ericc59 commented Jan 15, 2026

Summary

Add a centralized logging module with structured JSON output for better observability and debugging.

Features

  • StructuredFormatter: JSON output with ISO 8601 timestamps
  • HumanReadableFormatter: Clean console output (2026-01-15 14:32:50 | INFO | ...)
  • Context fields: task_id, config, duration_ms, tokens_used, cost_usd, error_type
  • LogContext: Context manager for adding fields to log records
  • log_with_context(): Helper for one-off contextual logging

Console Output

2026-01-15 14:32:50 | INFO     | __main__ | Running task 66e6c45b with config gpt-4o

File Output (JSON)

{"timestamp": "2026-01-15T20:32:50.397216+00:00", "level": "INFO", "logger": "__main__", "message": "Running task 66e6c45b"}

Files Changed

  • src/arc_agi_benchmarking/utils/logging_utils.py - New logging module
  • main.py - Integrated structured logging
  • cli/run_all.py - Integrated structured logging
  • src/arc_agi_benchmarking/tests/test_logging_utils.py - 17 unit tests

Test plan

  • All 253 tests pass
  • Console output is human-readable
  • File output is valid JSON
  • Context fields are properly included

- Create logging_utils.py with StructuredFormatter (JSON) and HumanReadableFormatter
- Console output uses human-readable format with timestamps
- File output uses JSON with ISO 8601 timestamps and context fields
- Support for context fields: task_id, config, duration_ms, tokens_used, cost_usd
- LogContext context manager for adding fields to log records
- Integrate into main.py and run_all.py entry points
- Add 17 unit tests for logging utilities
@gkamradt gkamradt merged commit 38f1821 into main Jan 15, 2026
6 checks passed
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.

2 participants