Skip to content

Commit ff5595c

Browse files
authored
ref(utils): Simplify console instrumentation (#4533)
Apply changes from #4505 that applied to `CaptureConsole` integration to the `instrumentConsole` func in `@sentry/utils`. It's important to note that the logic in utils, in `CaptureConsole` and the node `Console` integration is very similar, perhaps we can refactor to combine them.
1 parent ebba343 commit ff5595c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/utils/src/instrument.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ function instrumentConsole(): void {
116116
return;
117117
}
118118

119-
fill(global.console, level, function (originalConsoleLevel: () => any): Function {
119+
fill(global.console, level, function (originalConsoleMethod: () => any): Function {
120120
return function (...args: any[]): void {
121121
triggerHandlers('console', { args, level });
122122

123123
// this fails for some browsers. :(
124-
if (originalConsoleLevel) {
125-
Function.prototype.apply.call(originalConsoleLevel, global.console, args);
124+
if (originalConsoleMethod) {
125+
originalConsoleMethod.call(global.console, args);
126126
}
127127
};
128128
});

0 commit comments

Comments
 (0)