Skip to content
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

Add option to pass custom logger to rrweb record #831

Closed
wbobeirne opened this issue Feb 9, 2022 · 3 comments · Fixed by #1111
Closed

Add option to pass custom logger to rrweb record #831

wbobeirne opened this issue Feb 9, 2022 · 3 comments · Fixed by #1111
Labels
has PR already has pull request for it

Comments

@wbobeirne
Copy link

I use a custom logger in my frontend to send logs server side for analysis. Unfortunately I'm unable to record any rrweb debug logging since it uses a console.log with no way to override it:

private debug(...args: Parameters<typeof console.log>) {
if (!this.config.showDebug) {
return;
}
// tslint:disable-next-line: no-console
console.log(REPLAY_CONSOLE_PREFIX, ...args);
}
}

It'd be nice if there was an option for passing a custom function that would be called instead. Ideally the call happens before the showDebug check so that we can implement custom logic for showDebug instead of having to call setConfig to update it.

@Yuyz0112
Copy link
Member

Yuyz0112 commented Apr 7, 2022

cc @Mark-Fenng

@YunFeng0817
Copy link
Member

Maybe I can expand the showDebug option to receive a custom logger just like what we did in the console plugin. But I have one thing not sure about. Do I have to replace the warn log like this: https://github.com/rrweb-io/rrweb/blob/master/packages/rrweb/src/replay/index.ts#L1962-L1967 with the custom logger?

@wbobeirne
Copy link
Author

Do I have to replace the warn log... with the custom logger?

For my use case, that would be ideal. I'm trying to send rrweb logs to my server so that we can debug issues in production, so I'd like any and all logs to be accessible.

@YunFeng0817 YunFeng0817 added the has PR already has pull request for it label Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has PR already has pull request for it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants