-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: enable rrweb to record and replay log messages in console #424
Conversation
hijack all of the console functions. add listener to thrown errors
add limit to the max number of log records
this is the implementation of new feature request(issue #234) here are a few points of description. 1. users need to set recordLog option in rrweb.record's parameter to record log messages. The log recorder is off by default. 2. support recording and replaying all kinds of console functions. But the reliability of them should be tested more 3. the stringify function in stringify.ts needs improvement. e.g. robustness, handler for cyclical structures and better support for more kinds of object 4. we can replay the log messages in a simulated html console like LogRocket by implementing the interface "ReplayLogger" in the future
1. handle cyclical structures 2. add stringify option to limit the length of result 3. handle function type
@Yuyz0112 Could you please review this pull request😂 I've solved merge conflicts two times in the past one week |
src/types.ts
Outdated
}; | ||
|
||
// functions to replay log record | ||
export type ReplayLogger = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export type ReplayLogger = Record<LogLevel, (data: logData) => void>
Is this an equivalent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this one is better!
LGTM Most of the design looks great and just a few things need to be tweaked. |
There is no easy way to transmit events for when an unhandled exception happens on the page? |
this is the implementation of new feature request(issue #234 )(issue #317 )
here are a few points of description.