[LOGBack-dev] svn commit: r316 - logback/classic/trunk/src/main/java/ch/qos/logback/classic/util
noreply.ceki at qos.ch
noreply.ceki at qos.ch
Tue Jul 25 19:25:48 CEST 2006
Author: ceki
Date: Tue Jul 25 19:25:47 2006
New Revision: 316
Modified:
logback/classic/trunk/src/main/java/ch/qos/logback/classic/util/LoggerStatusPrinter.java
Log:
The same, but with less code.
Modified: logback/classic/trunk/src/main/java/ch/qos/logback/classic/util/LoggerStatusPrinter.java
==============================================================================
--- logback/classic/trunk/src/main/java/ch/qos/logback/classic/util/LoggerStatusPrinter.java (original)
+++ logback/classic/trunk/src/main/java/ch/qos/logback/classic/util/LoggerStatusPrinter.java Tue Jul 25 19:25:47 2006
@@ -1,48 +1,20 @@
package ch.qos.logback.classic.util;
-import java.util.Iterator;
-
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.core.status.Status;
import ch.qos.logback.core.status.StatusManager;
+import ch.qos.logback.core.util.StatusPrinter;
+
public class LoggerStatusPrinter {
- public static void print(StatusManager sm) {
- if (sm.getCount() == 0) {
- System.out.println("This status manager contains no errors.");
- return;
- }
- Iterator it = sm.iterator();
- while (it.hasNext()) {
- Status s = (Status) it.next();
- System.out.println(s);
- if (s.getThrowable() != null) {
- s.getThrowable().printStackTrace(System.out);
- }
- }
- }
-
- public static void printDefaultContext() {
+ public static void printStatusInDefaultContext() {
Logger logger = (Logger)LoggerFactory.getLogger(LoggerStatusPrinter.class);
LoggerContext lc = logger.getLoggerContext();
StatusManager sm = lc.getStatusManager();
-
- if (sm.getCount() == 0) {
- System.out.println("This status manager contains no errors.");
- return;
- }
- Iterator it = sm.iterator();
- while (it.hasNext()) {
- Status s = (Status) it.next();
- System.out.println(s);
- if (s.getThrowable() != null) {
- s.getThrowable().printStackTrace(System.out);
- }
- }
+ StatusPrinter.print(sm);
}
}
More information about the logback-dev
mailing list