Skip to content

chore(logging): replace logging.basicConfig with init_logging#3297

Open
jjolla93 wants to merge 2 commits intohuggingface:mainfrom
jjolla93:chore/structured-logging
Open

chore(logging): replace logging.basicConfig with init_logging#3297
jjolla93 wants to merge 2 commits intohuggingface:mainfrom
jjolla93:chore/structured-logging

Conversation

@jjolla93
Copy link
Copy Markdown

@jjolla93 jjolla93 commented Apr 6, 2026

Title

chore(logging): replace logging.basicConfig with init_logging (3 files)

Type / Scope

  • Type: Chore
  • Scope: logging

Summary / Motivation

Currently, LeRobot's logging uses three inconsistent patterns across the codebase:

  1. Direct logging.basicConfig() calls (3 files) — No multi-GPU support or standardized formatting
  2. Root logger direct callslogging.info() without module-level loggers (47 files)
  3. print() statements — Console output without structured logging (66 files)

This PR addresses the first pattern by replacing logging.basicConfig() with the existing init_logging() utility function.

This is Step 1 of a 5-part effort to standardize all logging across the codebase:

  • PR 1: basicConfig → init_logging (this PR)
  • 📋 PR 2: scripts/ — Add module-level logger
  • 📋 PR 3: rl/ — Add module-level logger
  • 📋 PR 4: datasets/, policies/, utils/ — Add module-level logger
  • 📋 PR 5: Replace strategic print() with logging

Related issues

What changed

Replace logging.basicConfig(level=logging.INFO) with init_logging() in three RL/camera modules:

  • src/lerobot/rl/eval_policy.py
  • src/lerobot/rl/gym_manipulator.py
  • src/lerobot/cameras/zmq/image_server.py

No breaking changes — init_logging() is drop-in replacement with enhanced configuration.

How was this tested

python -m pytest tests/rl/ -q        # 26/26 tests pass
python -m pytest tests/cameras/test_opencv.py::test_read -q  # 4/4 tests pass
pre-commit run -a                   # All checks pass

All tests pass. No functional changes to logging behavior.

Checklist (required before merge)

  • Linting/formatting run (pre-commit run -a)
  • All tests pass locally (pytest)
  • Documentation updated
  • CI is green

Reviewer notes

  • This PR is safe and minimal — it only replaces basicConfig() with an equivalent utility function. The init_logging() utility already exists and is used by all main CLI scripts (train, eval, record, etc.), so this change improves consistency without introducing new dependencies.
  • Future PRs will address the other two logging patterns (root logger calls and print statements).

AI Assistance Disclosure

This PR was developed with assistance from Claude AI. However:

✅ I have fully understood all proposed changes
✅ I wrote, tested, and verified all code thoroughly (30 tests passing, all pre-commit checks passed)
✅ I reviewed the implementation against LeRobot's architecture and conventions
✅ I ensured backward compatibility with existing code and datasets
✅ All changes are production-ready and well-documented
The AI tool was used to assist with code generation, refactoring suggestions, and initial implementations, but every line has been carefully reviewed and validated by the human contributor before submission.

jjolla93 and others added 2 commits April 6, 2026 17:23
Standardize logging configuration in:
- src/lerobot/rl/eval_policy.py
- src/lerobot/rl/gym_manipulator.py
- src/lerobot/cameras/zmq/image_server.py
@github-actions github-actions bot added the sensors Everything related to sensors label Apr 6, 2026
@jjolla93 jjolla93 mentioned this pull request Apr 6, 2026
@jjolla93 jjolla93 changed the title Chore/structured logging chore(logging): replace logging.basicConfig with init_logging Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sensors Everything related to sensors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant