|
From: <de...@us...> - 2012-10-25 11:32:52
|
Revision: 7808
http://fudaa.svn.sourceforge.net/fudaa/?rev=7808&view=rev
Author: deniger
Date: 2012-10-25 11:32:46 +0000 (Thu, 25 Oct 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLog.java
trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLogGroup.java
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLog.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLog.java 2012-10-25 07:32:39 UTC (rev 7807)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLog.java 2012-10-25 11:32:46 UTC (rev 7808)
@@ -35,7 +35,7 @@
public CtuluLog() {
super();
}
-
+
public void updateLocalizedMessage(ResourceBundle resourceBundle) {
if (logs != null) {
for (CtuluLogRecord ctuluLogRecord : logs) {
@@ -45,6 +45,21 @@
}
/**
+ *
+ * @return the higher level contained in this log.
+ */
+ public CtuluLogLevel getHigherLevel() {
+ CtuluLogLevel higher = null;
+ for (CtuluLogRecord ctuluLogRecord : logs) {
+ CtuluLogLevel level = ctuluLogRecord.getLevel();
+ if (higher == null || higher.isMoreVerboseThan(level, true)) {
+ higher = level;
+ }
+ }
+ return higher;
+ }
+
+ /**
* Constructeur precisant le resourceBundle a utiliser
*
* @param defaultResourceBundle
@@ -220,7 +235,7 @@
logs.add(o);
return o;
}
-
+
public void addRecord(CtuluLogRecord record) {
if (record != null) {
logs.add(record);
@@ -273,7 +288,7 @@
public void clear() {
logs.clear();
}
-
+
public boolean containsErrorOrSevereError() {
return containsErrors() || containsSevereError();
}
@@ -298,7 +313,7 @@
public boolean containsInfos() {
return containsLevel(CtuluLogLevel.INFO);
}
-
+
public int getNbOccurence(CtuluLogLevel level) {
int count = 0;
for (final CtuluLogRecord log : logs) {
@@ -307,7 +322,7 @@
}
}
return count;
-
+
}
/**
@@ -364,7 +379,7 @@
public String getResume() {
return getDesc() + "\n" + CtuluDefaultLogFormatter.formatLogs(logs, getDefaultResourceBundle());
}
-
+
public String getSevereError() {
CtuluLogRecord log = getFirstOfLevel(CtuluLogLevel.SEVERE);
return log == null ? null : CtuluDefaultLogFormatter.DEFAULT.format(log, getDefaultResourceBundle());
@@ -389,7 +404,7 @@
public boolean isEmpty() {
return logs.isEmpty();
}
-
+
public boolean isNotEmpty() {
return !isEmpty();
}
@@ -451,7 +466,7 @@
public void manageExceptionFromFile(final Exception _e, final String msg, final int line) {
addRecord(CtuluLogLevel.ERROR, msg, line).setThrown(_e);
}
-
+
public String getDesci18n() {
if (defaultResourceBundle == null) {
return description;
@@ -514,11 +529,11 @@
public void setDesc(final String _string) {
description = _string;
}
-
+
public String[] getDescriptionArgs() {
return descriptionArgs;
}
-
+
public void setDescriptionArgs(String... descriptionArgs) {
this.descriptionArgs = descriptionArgs;
}
Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLogGroup.java
===================================================================
--- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLogGroup.java 2012-10-25 07:32:39 UTC (rev 7807)
+++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLogGroup.java 2012-10-25 11:32:46 UTC (rev 7808)
@@ -28,6 +28,23 @@
return description;
}
+ public CtuluLogLevel getHigherLevel() {
+ CtuluLogLevel higher = null;
+ for (CtuluLog ctuluLog : logs) {
+ CtuluLogLevel thisLogHigherLevel = ctuluLog.getHigherLevel();
+ if (higher == null || higher.isMoreVerboseThan(thisLogHigherLevel, true)) {
+ higher = thisLogHigherLevel;
+ }
+ }
+ for (CtuluLogGroup ctuluLogGroup : groups) {
+ CtuluLogLevel thisLogHigherLevel = ctuluLogGroup.getHigherLevel();
+ if (higher == null || higher.isMoreVerboseThan(thisLogHigherLevel, true)) {
+ higher = thisLogHigherLevel;
+ }
+ }
+ return higher;
+ }
+
public void setDescription(String description) {
this.description = description;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|