Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
error: 4
};


function setupConsole(global) {

var originalConsole = global.console;

if (!global.nativeLoggingHook) {
return;
}
Expand Down Expand Up @@ -135,6 +138,18 @@
table: consoleTablePolyfill
};

// If available, also call the original `console` method since that is sometimes useful
// Ex. On OS X, this will let you see rich output to the Safari REPL console
if (originalConsole) {
Object.keys(global.console).forEach((methodName) => {
var nativeMethod = global.console[methodName];
global.console[methodName] = function () {
originalConsole[methodName].apply(originalConsole, arguments);
nativeMethod.apply(global.console, arguments);
};
});
}

}

if (typeof module !== 'undefined') {
Expand Down