You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2011/01/06 20:49:15 UTC
svn commit: r1056040 -
/ant/ivy/core/trunk/src/java/org/apache/ivy/util/Message.java
Author: hibou
Date: Thu Jan 6 19:49:14 2011
New Revision: 1056040
URL: http://svn.apache.org/viewvc?rev=1056040&view=rev
Log:
Add a generic function to log
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/util/Message.java
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/Message.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/Message.java?rev=1056040&r1=1056039&r2=1056040&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/Message.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/Message.java Thu Jan 6 19:49:14 2011
@@ -49,13 +49,13 @@ public final class Message {
/** Message priority of "debug". */
public static final int MSG_DEBUG = 4;
-
private static boolean showedInfo = false;
private static MessageLogger defaultLogger = new DefaultMessageLogger(Message.MSG_INFO);
/**
* Returns the current default logger.
+ *
* @return the current default logger; is never <code>null</code>.
*/
public static MessageLogger getDefaultLogger() {
@@ -64,7 +64,9 @@ public final class Message {
/**
* Change the default logger used when no other logger is currently configured
- * @param logger the new default logger, must not be <code>null</code>
+ *
+ * @param logger
+ * the new default logger, must not be <code>null</code>
*/
public static void setDefaultLogger(MessageLogger logger) {
Checks.checkNotNull(logger, "logger");
@@ -111,6 +113,28 @@ public final class Message {
getLogger().error(msg);
}
+ public static void log(int logLevel, String msg) {
+ switch (logLevel) {
+ case MSG_DEBUG:
+ debug(msg);
+ break;
+ case MSG_VERBOSE:
+ verbose(msg);
+ break;
+ case MSG_INFO:
+ info(msg);
+ break;
+ case MSG_WARN:
+ warn(msg);
+ break;
+ case MSG_ERR:
+ error(msg);
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown log level " + logLevel);
+ }
+ }
+
public static List getProblems() {
return getLogger().getProblems();
}