- Improve logging mechanism
- Manage errors on editor loading.
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
<include>${basedir}/target/tmp/header-min.js</include>
|
||||
<include>${basedir}/target/tmp/ColorPicker-min.js</include>
|
||||
<include>${basedir}/target/tmp/Loader-min.js</include>
|
||||
<include>${basedir}/target/tmp/Logger-min.js</include>
|
||||
<include>${basedir}/target/tmp/log4js-min.js</include>
|
||||
<include>${basedir}/target/tmp/Monitor-min.js</include>
|
||||
<include>${basedir}/target/tmp/Point-min.js</include>
|
||||
<include>${basedir}/target/tmp/UserAgent-min.js</include>
|
||||
|
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
core.Logger =
|
||||
{
|
||||
_enabled: false,
|
||||
setEnabled: function (enabled) {
|
||||
this._enabled = enabled;
|
||||
},init: function(serverLogger)
|
||||
{
|
||||
this._serverLogger = serverLogger;
|
||||
if (window.onerror) {
|
||||
// Save any previously defined handler to call
|
||||
core.Logger._origOnWindowError = window.onerror;
|
||||
}
|
||||
window.onerror = core.Logger._onWindowError;
|
||||
},
|
||||
log: function(message, severity, src)
|
||||
{
|
||||
if (!severity)
|
||||
{
|
||||
severity = core.LoggerSeverity.DEBUG;
|
||||
}
|
||||
|
||||
// Error messages must be loggued in the server ...
|
||||
if (severity >= core.LoggerSeverity.ERROR)
|
||||
{
|
||||
if (this._serverLogger)
|
||||
{
|
||||
try
|
||||
{
|
||||
this._serverLogger.logError(core.LoggerSeverity.ERROR, message);
|
||||
} catch(e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// // Finally, log the error in debug console if it's enabled.
|
||||
if (this._enabled)
|
||||
{
|
||||
this._browserLogger(message);
|
||||
}
|
||||
},
|
||||
_browserLogger: function(message) {
|
||||
// Firebug is not enabled.
|
||||
|
||||
if (core.Logger._origOnWindowError) {
|
||||
core.Logger._origOnWindowError();
|
||||
}
|
||||
|
||||
if (!console)
|
||||
{
|
||||
if (!this._isInitialized)
|
||||
{
|
||||
this._console = window.document.createElement("div");
|
||||
this._console.style.position = "absolute";
|
||||
this._console.style.width = "300px";
|
||||
this._console.style.height = "200px";
|
||||
this._console.style.bottom = 0;
|
||||
this._console.style.right = 0;
|
||||
this._console.style.border = '1px solid black';
|
||||
this._console.style.background = 'yellow';
|
||||
this._console.style.zIndex = 60000;
|
||||
|
||||
this._textArea = window.document.createElement("textarea");
|
||||
this._textArea.cols = "40";
|
||||
this._textArea.rows = "10";
|
||||
this._console.appendChild(this._textArea);
|
||||
|
||||
window.document.body.appendChild(this._console);
|
||||
this._isInitialized = true;
|
||||
}
|
||||
this._textArea.value = this._textArea.value + "\n" + msg;
|
||||
|
||||
} else
|
||||
{
|
||||
// Firebug console...
|
||||
console.log(message);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Handles logging of messages due to window error events.
|
||||
*
|
||||
* @method _onWindowError
|
||||
* @param sMsg {String} The error message.
|
||||
* @param sUrl {String} URL of the error.
|
||||
* @param sLine {String} Line number of the error.
|
||||
* @private
|
||||
*/
|
||||
_onWindowError: function(sMsg, sUrl, sLine) {
|
||||
// Logger is not in scope of this event handler
|
||||
// http://cfis.savagexi.com/articles/2007/05/08/what-went-wrong-with-my-javascript
|
||||
try {
|
||||
core.Logger.log(sMsg + ' (' + sUrl + ', line ' + sLine + ')', core.LoggerSeverity.ERROR, "window");
|
||||
}
|
||||
catch(e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
logError: function(msg) {
|
||||
core.Logger.log(msg, core.LoggerSeverity.ERROR, "code");
|
||||
}
|
||||
};
|
||||
|
||||
core.LoggerSeverity =
|
||||
{
|
||||
DEBUG: 1,
|
||||
WARNING: 2,
|
||||
ERROR: 3,
|
||||
WINDOW: 4
|
||||
};
|
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
core.UserAgent = {
|
||||
_isVMLSupported:null,
|
||||
isVMLSupported: function()
|
||||
@@ -31,10 +31,6 @@ core.UserAgent = {
|
||||
{
|
||||
return !core.UserAgent.isVMLSupported();
|
||||
},
|
||||
isIframeWorkaroundRequired: function()
|
||||
{
|
||||
return core.UserAgent.OS == "Mac" && core.UserAgent.browser == "Firefox" && core.UserAgent.version < 3;
|
||||
},
|
||||
isMozillaFamily: function()
|
||||
{
|
||||
return this.browser == "Netscape" || this.browser == "Firefox";
|
||||
|
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
core.Utils =
|
||||
{
|
||||
isDefined: function(val)
|
||||
@@ -70,21 +70,7 @@ core.assert = function(assert, message)
|
||||
|
||||
core.findElement = function(name)
|
||||
{
|
||||
var result;
|
||||
if (core.UserAgent.isIframeWorkaroundRequired())
|
||||
{
|
||||
var iframe = $('mindplotIFrame');
|
||||
var doc = iframe.contentDocument;
|
||||
if (doc == undefined || doc == null)
|
||||
doc = iframe.contentWindow.document;
|
||||
result = $(doc.getElementById(name));
|
||||
}
|
||||
if (!result)
|
||||
{
|
||||
result = $(name);
|
||||
}
|
||||
|
||||
return result;
|
||||
return $(name);
|
||||
}
|
||||
|
||||
Math.sign = function(value)
|
||||
|
@@ -1,96 +1,47 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
/*
|
||||
Created By: Chris Campbell
|
||||
Website: http://particletree.com
|
||||
Date: 2/1/2006
|
||||
Created By: Chris Campbell
|
||||
Website: http://particletree.com
|
||||
Date: 2/1/2006
|
||||
|
||||
Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
|
||||
*/
|
||||
Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------GLOBAL VARIABLES------------------------------------*/
|
||||
|
||||
var detect = navigator.userAgent.toLowerCase();
|
||||
var OS,browser,version,total,thestring;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
|
||||
//Browser detect script origionally created by Peter Paul Koch at http://www.quirksmode.org/
|
||||
|
||||
function getBrowserInfo(evt) {
|
||||
if (checkIt('konqueror')) {
|
||||
browser = "Konqueror";
|
||||
OS = "Linux";
|
||||
}
|
||||
else if (checkIt('safari')) browser = "Safari"
|
||||
else if (checkIt('omniweb')) browser = "OmniWeb"
|
||||
else if (checkIt('opera')) browser = "Opera"
|
||||
else if (checkIt('webtv')) browser = "WebTV";
|
||||
else if (checkIt('icab')) browser = "iCab"
|
||||
else if (checkIt('msie')) browser = "Internet Explorer"
|
||||
else if (!checkIt('compatible')) {
|
||||
browser = "Netscape Navigator"
|
||||
version = detect.charAt(8);
|
||||
}
|
||||
else browser = "An unknown browser";
|
||||
|
||||
if (!version) version = detect.charAt(place + thestring.length);
|
||||
|
||||
if (!OS) {
|
||||
if (checkIt('linux')) OS = "Linux";
|
||||
else if (checkIt('x11')) OS = "Unix";
|
||||
else if (checkIt('mac')) OS = "Mac"
|
||||
else if (checkIt('win')) OS = "Windows"
|
||||
else OS = "an unknown operating system";
|
||||
}
|
||||
}
|
||||
|
||||
function checkIt(string) {
|
||||
place = detect.indexOf(string) + 1;
|
||||
thestring = string;
|
||||
return place;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
|
||||
$(window).addEvent('load', getBrowserInfo);
|
||||
|
||||
core.WaitDialog = new Class({
|
||||
|
||||
initialize: function(contentId) {
|
||||
this.content = $(contentId);
|
||||
},
|
||||
|
||||
yPos : 0,
|
||||
|
||||
xPos : 0,
|
||||
|
||||
// Turn everything on - mainly the IE fixes
|
||||
activate: function(changeCursor)
|
||||
initialize: function() {
|
||||
},
|
||||
// Turn everything on - mainly the IE fixes
|
||||
activate: function(changeCursor, dialogContent)
|
||||
{
|
||||
// if (browser == 'Internet Explorer'){
|
||||
//// this.getScroll();
|
||||
// this.prepareIE('100%', 'hidden');
|
||||
//// this.setScroll(0,0);
|
||||
//// this.hideSelects('hidden');
|
||||
// }
|
||||
|
||||
this.content = dialogContent;
|
||||
|
||||
this._initLightboxMarkup();
|
||||
|
||||
this.displayLightbox("block");
|
||||
|
||||
// Change to loading cursor.
|
||||
@@ -99,41 +50,27 @@ core.WaitDialog = new Class({
|
||||
window.document.body.style.cursor = "wait";
|
||||
}
|
||||
},
|
||||
changeContent: function(dialogContent, changeCursor)
|
||||
{
|
||||
this.content = dialogContent;
|
||||
if (!$('lbContent'))
|
||||
{
|
||||
// Dialog is not activated. Nothing to do ...
|
||||
window.document.body.style.cursor = "pointer";
|
||||
return;
|
||||
}
|
||||
|
||||
// Ie requires height to 100% and overflow hidden or else you can scroll down past the lightbox
|
||||
prepareIE: function(height, overflow) {
|
||||
bod = document.getElementsByTagName('body')[0];
|
||||
bod.style.height = height;
|
||||
bod.style.overflow = overflow;
|
||||
this.processInfo();
|
||||
|
||||
htm = document.getElementsByTagName('html')[0];
|
||||
htm.style.height = height;
|
||||
htm.style.overflow = overflow;
|
||||
},
|
||||
|
||||
// In IE, select elements hover on top of the lightbox
|
||||
hideSelects: function(visibility) {
|
||||
selects = document.getElementsByTagName('select');
|
||||
for (i = 0; i < selects.length; i++) {
|
||||
selects[i].style.visibility = visibility;
|
||||
// Change to loading cursor.
|
||||
if (changeCursor)
|
||||
{
|
||||
window.document.body.style.cursor = "wait";
|
||||
}else
|
||||
{
|
||||
window.document.body.style.cursor = "auto";
|
||||
}
|
||||
},
|
||||
|
||||
// Taken from lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
|
||||
getScroll: function() {
|
||||
if (self.pageYOffset) {
|
||||
this.yPos = self.pageYOffset;
|
||||
} else if (document.documentElement && document.documentElement.scrollTop) {
|
||||
this.yPos = document.documentElement.scrollTop;
|
||||
} else if (document.body) {
|
||||
this.yPos = document.body.scrollTop;
|
||||
}
|
||||
},
|
||||
|
||||
setScroll: function(x, y) {
|
||||
window.scrollTo(x, y);
|
||||
},
|
||||
|
||||
displayLightbox: function(display) {
|
||||
$('overlay').style.display = display;
|
||||
$('lightbox').style.display = display;
|
||||
@@ -141,15 +78,19 @@ core.WaitDialog = new Class({
|
||||
this.processInfo();
|
||||
},
|
||||
|
||||
// Display Ajax response
|
||||
// Display dialog content ...
|
||||
processInfo: function() {
|
||||
var info = new Element('div').setProperty('id', 'lbContent');
|
||||
info.setHTML(this.content.innerHTML);
|
||||
info.injectBefore($('lbLoadMessage'));
|
||||
if ($('lbContent'))
|
||||
$('lbContent').remove();
|
||||
|
||||
var lbContentElement = new Element('div').setProperty('id', 'lbContent');
|
||||
lbContentElement.setHTML(this.content.innerHTML);
|
||||
|
||||
lbContentElement.injectBefore($('lbLoadMessage'));
|
||||
$('lightbox').className = "done";
|
||||
},
|
||||
|
||||
// Search through new links within the lightbox, and attach click event
|
||||
// Search through new links within the lightbox, and attach click event
|
||||
actions: function() {
|
||||
lbActions = document.getElementsByClassName('lbAction');
|
||||
|
||||
@@ -164,53 +105,31 @@ core.WaitDialog = new Class({
|
||||
|
||||
},
|
||||
|
||||
// Example of creating your own functionality once lightbox is initiated
|
||||
insert: function(e) {
|
||||
var event = new Event(e);
|
||||
link = event.target;
|
||||
if ($('lbContent'))
|
||||
$('lbContent').remove();
|
||||
|
||||
var myAjax = new Ajax.Request(
|
||||
link.href,
|
||||
{method: 'post', parameters: "", onComplete: this.processInfo.pass(this)}
|
||||
);
|
||||
|
||||
},
|
||||
|
||||
// Example of creating your own functionality once lightbox is initiated
|
||||
// Example of creating your own functionality once lightbox is initiated
|
||||
deactivate: function(time) {
|
||||
|
||||
if ($('lbContent'))
|
||||
$('lbContent').remove();
|
||||
//
|
||||
// if (browser == "Internet Explorer"){
|
||||
// this.setScroll(0,this.yPos);
|
||||
// this.prepareIE("auto", "auto");
|
||||
// this.hideSelects("visible");
|
||||
// }
|
||||
|
||||
this.displayLightbox("none");
|
||||
|
||||
window.document.body.style.cursor = "default";
|
||||
}
|
||||
});
|
||||
, _initLightboxMarkup:function()
|
||||
{
|
||||
// Add overlay element inside body ...
|
||||
var bodyElem = document.getElementsByTagName('body')[0];
|
||||
var overlayElem = new Element('div').setProperty('id', 'overlay');
|
||||
overlayElem.injectInside(bodyElem);
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// Add lightbox element inside body ...
|
||||
var lightboxElem = new Element('div').setProperty('id', 'lightbox');
|
||||
lightboxElem.addClass('loading');
|
||||
|
||||
// Onload, make all links that need to trigger a lightbox active
|
||||
function initialize() {
|
||||
addLightboxMarkup();
|
||||
valid = new core.WaitDialog($('sampleDialog'));
|
||||
}
|
||||
var lbLoadMessageElem = new Element('div').setProperty('id', 'lbLoadMessage');
|
||||
lbLoadMessageElem.injectInside(lightboxElem);
|
||||
|
||||
// Add in markup necessary to make this work. Basically two divs:
|
||||
// Overlay holds the shadow
|
||||
// Lightbox is the centered square that the content is put into.
|
||||
function addLightboxMarkup() {
|
||||
var body = document.getElementsByTagName('body')[0];
|
||||
overlay = new Element('div').setProperty('id', 'overlay').injectInside(document.body);
|
||||
var lb = new Element('div').setProperty('id', 'lightbox');
|
||||
lb.addClass('loading');
|
||||
var tmp = new Element('div').setProperty('id', 'lbLoadMessage').injectInside(lb);
|
||||
lb.injectInside(document.body);
|
||||
}
|
||||
lightboxElem.injectInside(bodyElem);
|
||||
|
||||
}
|
||||
});
|
@@ -1,21 +1,94 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
// Init default logger level ...
|
||||
var wLogger = new Log4js.getLogger("WiseMapping");
|
||||
wLogger.setLevel(Log4js.Level.ALL);
|
||||
wLogger.addAppender(new Log4js.BrowserConsoleAppender());
|
||||
|
||||
// Is logger service available ?
|
||||
if (window.LoggerService)
|
||||
{
|
||||
Log4js.WiseServerAppender = function()
|
||||
{
|
||||
this.layout = new Log4js.SimpleLayout();
|
||||
};
|
||||
|
||||
Log4js.WiseServerAppender.prototype = Log4js.extend(new Log4js.Appender(), {
|
||||
/**
|
||||
* @see Log4js.Appender#doAppend
|
||||
*/
|
||||
doAppend: function(loggingEvent) {
|
||||
try {
|
||||
var message = this.layout.format(loggingEvent);
|
||||
var level = this.levelCode(loggingEvent);
|
||||
|
||||
window.LoggerService.logError(level, message);
|
||||
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* toString
|
||||
*/
|
||||
toString: function() {
|
||||
return "Log4js.WiseServerAppender";
|
||||
},
|
||||
|
||||
levelCode: function(loggingEvent)
|
||||
{
|
||||
var retval;
|
||||
switch (loggingEvent.level) {
|
||||
case Log4js.Level.FATAL:
|
||||
retval = 3;
|
||||
break;
|
||||
case Log4js.Level.ERROR:
|
||||
retval = 3;
|
||||
break;
|
||||
case Log4js.Level.WARN:
|
||||
retval = 2;
|
||||
break;
|
||||
default:
|
||||
retval = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
});
|
||||
|
||||
wLogger.addAppender(new Log4js.WiseServerAppender());
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Handle error events ...
|
||||
window.onerror = function(sMsg, sUrl, sLine)
|
||||
{
|
||||
window.hasUnexpectedErrors = true;
|
||||
var msg = sMsg + ' (' + sUrl + ', line ' + sLine + ')';
|
||||
wLogger.fatal(msg);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
window.__coreLoad = function()
|
||||
{
|
||||
|
@@ -17,4 +17,4 @@
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
var core = {};
|
||||
var core = {};
|
||||
|
2501
trunk/core-js/src/main/javascript/log4js.js
Normal file
2501
trunk/core-js/src/main/javascript/log4js.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user