Code Quality: Migrate logger.py to structlog for robust JSON logs - #257
Open
pradeep0153 wants to merge 1 commit into
Open
Code Quality: Migrate logger.py to structlog for robust JSON logs#257pradeep0153 wants to merge 1 commit into
logger.py to structlog for robust JSON logs#257pradeep0153 wants to merge 1 commit into
Conversation
|
@pradeep0153 is attempting to deploy a commit to the sreerevanth's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #245.
Description
This PR executes a foundational architectural refactoring of the telemetry and logging layer within Repopilot. The current
logger.pyimplemented a custom, brittle JSONL writer for appending iteration data (<run_id>.jsonl).As the project scaled and we added more telemetry (sandbox execution times, token counts, linter outputs), manually constructing and appending JSON dictionaries became highly error-prone. A single unescaped quote or nested un-serializable object caused the
json.dumps()call to violently throw an exception, crashing the entire agent loop just to write a log line. Furthermore, the human-readable logs (_human.log) completely lacked consistent formatting, levels, and chronological timestamping. We needed to execute a major code quality initiative by migrating to an industry-standard, structured logging pipeline.Changes Made
logger.pystring-formatting implementations.structloglibrary.ConsoleRendererdynamically formats logs for the CLI and_human.logwith colors and clean alignment. TheJSONRendererstrictly handles the.jsonltelemetry file.Impact
json.dumpslogic for critical telemetry is a fatal anti-pattern that guarantees data corruption and agent crashes. By engineering thisstructlogpipeline, we mathematically eradicate logging exceptions. We guarantee that the JSONL telemetry files are structurally flawless, enabling seamless ingestion into Datadog or ELK, while drastically improving the local debugging experience for developers.