You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2011/03/18 20:43:57 UTC
svn commit: r1083027 -
/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/logging.js
Author: lofwyr
Date: Fri Mar 18 19:43:57 2011
New Revision: 1083027
URL: http://svn.apache.org/viewvc?rev=1083027&view=rev
Log:
adding utils to access to logging messages
Modified:
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/logging.js
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/logging.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/logging.js?rev=1083027&r1=1083026&r2=1083027&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/logging.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/logging.js Fri Mar 18 19:43:57 2011
@@ -41,6 +41,33 @@ var LOG = {
return this.maximumSeverity;
},
+ getMessages: function(severity) {
+ var result = "";
+ for each (var message in this.messages) {
+ if (message.type >= severity) {
+ result = result.concat(this.getSeverityName(message.type));
+ result = result.concat(": ");
+ result = result.concat(message.message);
+ result = result.concat("\n");
+ }
+ }
+ return result;
+ },
+
+ getSeverityName: function(severity) {
+ if (LOG.ERROR == severity) {
+ return "Error: ";
+ } else if (LOG.WARN == severity) {
+ return "Warn: ";
+ } else if (LOG.INFO == severity) {
+ return "Info: ";
+ } else if (LOG.DEBUG == severity) {
+ return "Debug: ";
+ }
+ return "";
+ },
+
+
addAppender: function(appender) {
this.appenders.push(appender);
},
@@ -362,16 +389,7 @@ LOG.LogArea.prototype.append = function(
if (typeof(message) == "string") {
logMessage = document.createTextNode(message);
} else if (typeof(message.type) == "number") {
- var prefix = "";
- if (LOG.ERROR == message.type) {
- prefix = prefix + "Error: ";
- } else if (LOG.WARN == message.type) {
- prefix = prefix + "Warn: ";
- } else if (LOG.INFO == message.type) {
- prefix = prefix + "Info: ";
- } else if (LOG.DEBUG == message.type) {
- prefix = prefix + "Debug: ";
- }
+ var prefix = LOG.getSeverityName(message.type);
logMessage = document.createTextNode(prefix + message.message);
}
listElement.appendChild(logMessage);