Skip to content

feat(#127): robot logging#128

Merged
PatrykPaluch merged 9 commits intomainfrom
feat/127/robot-logging
Mar 20, 2026
Merged

feat(#127): robot logging#128
PatrykPaluch merged 9 commits intomainfrom
feat/127/robot-logging

Conversation

@PatrykPaluch
Copy link
Copy Markdown
Member

Closes #127

@PatrykPaluch PatrykPaluch marked this pull request as draft January 3, 2026 03:38
Comment thread Assets/Scripts/RobotProgramming/RobotLogger.cs Outdated
@PatrykPaluch PatrykPaluch marked this pull request as ready for review January 6, 2026 03:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 RobotLogger as a static thread-safe logger with event-based subscriptions for per-robot and global logging
  • Created RobotDebugHelper to capture and format stack traces across execution context switches between JavaScript and C# code
  • Migrated all engine logic classes from direct Debug.Log calls to use the new RobotLogger API

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.

Comment thread Assets/Scripts/RobotProgramming/RobotDebugHelper.cs
Comment thread Assets/Scripts/RobotProgramming/ProgrammableData.cs Outdated
Comment thread Assets/Tests/EditModeTests/RobotLoggingTest.cs Outdated
Comment thread Assets/Scripts/RobotProgramming/RobotLogger.cs Outdated
Comment thread Assets/Scripts/RobotProgramming/RobotDebugHelper.cs Outdated
Comment thread Assets/Tests/EditModeTests/RobotLoggingTest.cs Outdated
Comment thread Assets/Tests/EditModeTests/RobotLoggingTest.cs
Comment thread Assets/Tests/EditModeTests/RobotLoggingTest.cs Outdated
{
int robotIndex = i;
robots[i] = GetMockedProgrammableData();
robotResetGate[i] = new ManualResetEventSlim(false);
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

Disposable 'ManualResetEventSlim' is created but not disposed.

Copilot uses AI. Check for mistakes.
Comment thread Assets/Scripts/RobotProgramming/Programmable.cs
@strunk23
Copy link
Copy Markdown
Contributor

30x75cm

Acu1000
Acu1000 previously approved these changes Mar 6, 2026
Copy link
Copy Markdown
Collaborator

@Acu1000 Acu1000 left a comment

Choose a reason for hiding this comment

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

LGTM

strunk23
strunk23 previously approved these changes Mar 14, 2026
Copy link
Copy Markdown
Contributor

@strunk23 strunk23 left a comment

Choose a reason for hiding this comment

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

LGTM

@PatrykPaluch PatrykPaluch dismissed stale reviews from strunk23 and Acu1000 via 7d894c2 March 20, 2026 18:31
@PatrykPaluch PatrykPaluch merged commit 54dd804 into main Mar 20, 2026
2 checks passed
@strunk23 strunk23 deleted the feat/127/robot-logging branch March 20, 2026 18:32
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.

Unify Robot logging

4 participants