Merged
Conversation
PatrykPaluch
commented
Jan 3, 2026
There was a problem hiding this comment.
Pull request overview
This PR implements a comprehensive robot logging system that addresses issue #127 by creating a singleton logger that allows robots to log messages, retrieve logs by robot, and subscribe to logging events. The implementation includes thread-safe logging with async local context tracking, stack trace debugging capabilities, and integration with Unity's debug console.
Key Changes
- Implemented
RobotLoggeras a static thread-safe logger with event-based subscriptions for per-robot and global logging - Created
RobotDebugHelperto capture and format stack traces across execution context switches between JavaScript and C# code - Migrated all engine logic classes from direct
Debug.Logcalls to use the newRobotLoggerAPI
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 24 comments.
Show a summary per file
| File | Description |
|---|---|
| Assets/Scripts/RobotProgramming/RobotLogger.cs | Core static logger implementation with concurrent dictionaries for thread-safe log storage and event handling |
| Assets/Scripts/RobotProgramming/RobotLoggerSingletonSystem.cs | Unity MonoBehaviour singleton that pumps logs from background threads to main thread and manages lifecycle |
| Assets/Scripts/RobotProgramming/RobotDebugHelper.cs | Stack trace capture and formatting utility for debugging robot execution contexts |
| Assets/Scripts/RobotProgramming/ProgrammableData.cs | Thread-safe data structure representing robot instances with Unity object reference separation |
| Assets/Scripts/RobotProgramming/Programmable.cs | Updated to initialize logger context for each robot thread and log JavaScript exceptions |
| Assets/Scripts/RobotProgramming/ProgrammableFunctionWrapper.cs | Enhanced to capture execution context for stack trace debugging across thread boundaries |
| Assets/Scripts/RobotProgramming/LogEntry.cs | Added constructor overload for creating log entries with automatic timestamp |
| Assets/Scripts/RobotProgramming/LogLevel.cs | Added GetConstSizeName() method for fixed-width log level formatting |
| Assets/Scripts/RobotProgramming/EngineLogic/*.cs | Migrated from BaseEngineLogic logging methods to RobotLogger static methods |
| Assets/Scripts/Utils/GameInfo.cs | Utility class providing game metadata and bug report URL |
| Assets/Scripts/Utils/ExecutionOrder.cs | Added execution order constant for RobotLogger singleton |
| Assets/Scripts/Utils/ReferenceEqualityComparer.cs | Generic equality comparer using reference equality for dictionary keys |
| Assets/Tests/EditModeTests/RobotLoggingTest.cs | Comprehensive tests for multithreaded logging, event handlers, and log retrieval |
| Assets/Scenes/RobotAPI.unity | Added RobotLoggerSystem and dummy log receiver to scene for testing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| int robotIndex = i; | ||
| robots[i] = GetMockedProgrammableData(); | ||
| robotResetGate[i] = new ManualResetEventSlim(false); |
There was a problem hiding this comment.
Disposable 'ManualResetEventSlim' is created but not disposed.
Contributor
|
30x75cm |
strunk23
approved these changes
Mar 20, 2026
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 #127