Commit e3fca68a authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

improving log function to work on IE8 and IE9 too

parent 35a8c4e1
......@@ -76,12 +76,28 @@
};
var Log4js = {
logger: null,
debug : function() { if (PushStream.LOG_LEVEL === 'debug') Log4js._log.apply(Log4js._log, arguments); },
info : function() { if ((PushStream.LOG_LEVEL === 'info') || (PushStream.LOG_LEVEL === 'debug')) Log4js._log.apply(Log4js._log, arguments); },
error : function() { Log4js._log.apply(Log4js._log, arguments); },
_log : function() {
if (window.console && window.console.log && window.console.log.apply) {
window.console.log.apply(window.console, arguments);
if (!Log4js.logger) {
var console = window.console;
if (console && console.log) {
if (console.log.apply) {
Log4js.logger = console.log;
} else if ((typeof console.log == "object") && Function.prototype.bind) {
Log4js.logger = Function.prototype.bind.call(console.log, console);
} else if ((typeof console.log == "object") && Function.prototype.call) {
Log4js.logger = function() {
Function.prototype.call.call(console.log, console, Array.prototype.slice.call(arguments));
}
}
}
}
if (Log4js.logger) {
Log4js.logger.apply(window.console, arguments);
}
var logElement = document.getElementById(PushStream.LOG_OUTPUT_ELEMENT_ID);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment