Skip to content

Add rrweb event logging to console for debugging#1173

Merged
matux merged 2 commits intomasterfrom
matux/rrweb-event-logging
Apr 18, 2025
Merged

Add rrweb event logging to console for debugging#1173
matux merged 2 commits intomasterfrom
matux/rrweb-event-logging

Conversation

@matux
Copy link
Copy Markdown
Contributor

@matux matux commented Apr 18, 2025

Description of the change

  • Added a new debug configuration option in src/browser/replay/defaults.js to enable or disable logging of emitted events. (logEmits is set to false by default).
  • Implemented a _logEvent method in src/browser/replay/recorder.js to log emitted events in a readable JSON format, handling circular references gracefully. This method is invoked when logEmits is enabled in the debug configuration.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

Related issues

@matux matux requested review from Copilot and waltjones April 18, 2025 16:47
@matux matux self-assigned this Apr 18, 2025
@linear
Copy link
Copy Markdown

linear bot commented Apr 18, 2025

Copy link
Copy Markdown
Contributor

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 adds a debugging feature to log rrweb events in a readable JSON format, particularly useful when diagnosing replay behavior.

  • Introduces a new debug configuration (logEmits) in the defaults file.
  • Implements a _logEvent method in Recorder to safely stringify events with circular references.
  • Updates the checkout interval to a more readable expression.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/browser/replay/recorder.js Adds _logEvent method and integrates conditional logging of events.
src/browser/replay/defaults.js Introduces new debug configuration for logging events.
Comments suppressed due to low confidence (1)

src/browser/replay/recorder.js:188

  • [nitpick] Consider refining the log message formatting to avoid extra spacing when isCheckout is false, such as outputting 'Recorder: event' consistently.
`Recorder: ${isCheckout ? 'checkout' : ''} event\n`,

@matux matux merged commit 39aff97 into master Apr 18, 2025
4 checks passed
@matux matux deleted the matux/rrweb-event-logging branch April 18, 2025 23:36
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.

3 participants