Implemented the appendSafeMessage() methods.
authorMarco Zanon <info@marcozanon.com>
Fri, 5 Aug 2022 13:07:09 +0000 (13:07 +0000)
committerMarco Zanon <info@marcozanon.com>
Fri, 5 Aug 2022 13:07:09 +0000 (13:07 +0000)
src/main/java/com/marcozanon/macaco/logging/MLogFilter.java

index 353ec983b8d9c6b92739b233d8ad2435a06c2a1e..182f6112ac7b2d2499c0a8b31db7dc922242ad44 100644 (file)
@@ -94,6 +94,16 @@ public class MLogFilter extends MObject {
         return this.appendMessage(level, message, 0);
     }
 
+    public boolean appendSafeMessage(MLogFilter.Threshold level, String message) {
+        try {
+            return this.appendMessage(level, message);
+        }
+        catch (MLoggingException exception) {
+        }
+        //
+        return false;
+    }
+
     public boolean appendMessage(MLogFilter.Threshold level, String message, int indentation) throws MLoggingException {
         if (null == level) {
             throw new IllegalArgumentException("Invalid 'level': null.");
@@ -112,6 +122,16 @@ public class MLogFilter extends MObject {
         return true;
     }
 
+    public boolean appendSafeMessage(MLogFilter.Threshold level, String message, int indentation) {
+        try {
+            return this.appendMessage(level, message, indentation);
+        }
+        catch (MLoggingException exception) {
+        }
+        //
+        return false;
+    }
+
     protected void flushMessages() throws MLoggingException {
         while (0 < this.logMessageQueue.size()) {
             MLogMessage logMessage = this.logMessageQueue.remove();