Skip to content

Commit d898730

Browse files
authored
ref(integrations): Simplify calling original method in CaptureConsole (#4505)
In responding to #4504, I noticed two things which could be improved about the code in question: 1) The author of that PR was misled by the admittedly confusing name of the original method we're wrapping. 2) We've been calling that method in a more complex way than necessary. This fixes both of those problems.
1 parent 1a6c26e commit d898730

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/integrations/src/captureconsole.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class CaptureConsole implements Integration {
4343
}
4444

4545
// eslint-disable-next-line @typescript-eslint/no-explicit-any
46-
fill(global.console, level, (originalConsoleLevel: () => any) => (...args: any[]): void => {
46+
fill(global.console, level, (originalConsoleMethod: () => any) => (...args: any[]): void => {
4747
const hub = getCurrentHub();
4848

4949
if (hub.getIntegration(CaptureConsole)) {
@@ -71,8 +71,8 @@ export class CaptureConsole implements Integration {
7171
}
7272

7373
// this fails for some browsers. :(
74-
if (originalConsoleLevel) {
75-
Function.prototype.apply.call(originalConsoleLevel, global.console, args);
74+
if (originalConsoleMethod) {
75+
originalConsoleMethod.call(global.console, args);
7676
}
7777
});
7878
});

0 commit comments

Comments
 (0)