You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ja...@apache.org on 2022/11/08 01:02:55 UTC

[ant] branch master updated: Introduce a getMessageOutputLevel() method on BuildLogger to return the currently set message output level

This is an automated email from the ASF dual-hosted git repository.

jaikiran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git


The following commit(s) were added to refs/heads/master by this push:
     new 65d3af7d5 Introduce a getMessageOutputLevel() method on BuildLogger to return the currently set message output level
65d3af7d5 is described below

commit 65d3af7d55b35ec0e3a3dc6a464c5f6f0ab7ef2a
Author: Jaikiran Pai <ja...@apache.org>
AuthorDate: Tue Nov 8 06:18:06 2022 +0530

    Introduce a getMessageOutputLevel() method on BuildLogger to return the currently set message output level
---
 WHATSNEW                                                       |  3 +++
 src/main/org/apache/tools/ant/BuildLogger.java                 | 10 ++++++++++
 src/main/org/apache/tools/ant/DefaultLogger.java               |  5 +++++
 src/main/org/apache/tools/ant/XmlLogger.java                   |  5 +++++
 .../org/apache/tools/ant/listener/CommonsLoggingListener.java  |  5 +++++
 src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java      |  5 +++++
 6 files changed, 33 insertions(+)

diff --git a/WHATSNEW b/WHATSNEW
index 52282736b..ca067e3c3 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -68,6 +68,9 @@ Other changes:
    attribute if it doesn't exist.
    Bugzilla Report 66231
 
+ * org.apache.tools.ant.BuildLogger now has a new method getMessageOutputLevel()
+   which returns the currently set message output level.
+
 Changes from Ant 1.10.11 TO Ant 1.10.12
 =======================================
 
diff --git a/src/main/org/apache/tools/ant/BuildLogger.java b/src/main/org/apache/tools/ant/BuildLogger.java
index 08123aac2..c0b7ab9a8 100644
--- a/src/main/org/apache/tools/ant/BuildLogger.java
+++ b/src/main/org/apache/tools/ant/BuildLogger.java
@@ -46,6 +46,16 @@ public interface BuildLogger extends BuildListener {
      */
     void setMessageOutputLevel(int level);
 
+
+    /**
+     * @return Returns the {@link #setMessageOutputLevel(int) currently set} message output level.
+     * The {@code default} implementation of this method returns {@code MSG_INFO}.
+     * @since 1.10.13
+     */
+    default int getMessageOutputLevel() {
+        return Project.MSG_INFO;
+    }
+
     /**
      * Sets the output stream to which this logger is to send its output.
      *
diff --git a/src/main/org/apache/tools/ant/DefaultLogger.java b/src/main/org/apache/tools/ant/DefaultLogger.java
index af503ea21..10e2b06b8 100644
--- a/src/main/org/apache/tools/ant/DefaultLogger.java
+++ b/src/main/org/apache/tools/ant/DefaultLogger.java
@@ -93,6 +93,11 @@ public class DefaultLogger implements BuildLogger {
         this.msgOutputLevel = level;
     }
 
+    @Override
+    public int getMessageOutputLevel() {
+        return this.msgOutputLevel;
+    }
+
     /**
      * Sets the output stream to which this logger is to send its output.
      *
diff --git a/src/main/org/apache/tools/ant/XmlLogger.java b/src/main/org/apache/tools/ant/XmlLogger.java
index b75ce2f4d..14a82115a 100644
--- a/src/main/org/apache/tools/ant/XmlLogger.java
+++ b/src/main/org/apache/tools/ant/XmlLogger.java
@@ -432,6 +432,11 @@ public class XmlLogger implements BuildLogger {
         msgOutputLevel = level;
     }
 
+    @Override
+    public int getMessageOutputLevel() {
+        return this.msgOutputLevel;
+    }
+
     /**
      * Set the output stream to which logging output is sent when operating
      * as a logger.
diff --git a/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java b/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java
index f813eba0e..2c8ee51ca 100644
--- a/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java
+++ b/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java
@@ -308,6 +308,11 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger {
         // Use the logger config
     }
 
+    @Override
+    public int getMessageOutputLevel() {
+        return Project.MSG_INFO;
+    }
+
     /**
      * Set the output print stream.
      * @param output the output stream
diff --git a/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java b/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
index ee6f3631c..4a40af25e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
+++ b/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
@@ -237,6 +237,11 @@ public class RecorderEntry implements BuildLogger, SubBuildListener {
         }
     }
 
+    @Override
+    public int getMessageOutputLevel() {
+        return this.loglevel;
+    }
+
     /**
      * @see BuildLogger#setOutputPrintStream(PrintStream)
      * {@inheritDoc}.