I'm attempting to redirect console calls to the log4javascript library.
Essentially, any usage of console.log
should trigger log.info
, with log
being an instance of Log4javascript.
However, when log.info
is invoked, I encounter a "Fonction attendue" error (French), indicating "Function expected".
Even trying to execute log.info
from the IE8 console leads to the same issue.
I don't believe the problem lies within the script itself, but just in case, here it is:
(function (fallback) {
fallback = fallback || function () { };
// Function for trapping most console functions from the FireBug Console API.
var trap = function () {
// Create array from arguments object
var args = Array.prototype.slice.call(arguments);
// Capturing raw args without converting to string
console.raw.push(args);
var message = args.join(' ');
console.messages.push(message);
fallback(message);
};
// Redefining console
if (typeof console === 'undefined') {
console = {
messages: [],
raw: [],
dump: function() { return console.messages.join('\n'); },
log: trap,
debug: trap,
info: trap,
warn: trap,
error: trap,
assert: trap,
clear: function() {
console.messages.length = 0;
console.raw.length = 0 ;
},
dir: trap,
dirxml: trap,
trace: trap,
group: trap,
groupCollapsed: trap,
groupEnd: trap,
time: trap,
timeEnd: trap,
timeStamp: trap,
profile: trap,
profileEnd: trap,
count: trap,
exception: trap,
table: trap
};
}
})(log.info);
I believed that Log4Javascript was compatible with IE8, so what could be causing this issue? Appreciate any insights.