You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mailet-api@james.apache.org by no...@apache.org on 2011/01/20 20:30:54 UTC

svn commit: r1061472 - /james/mailet/api/trunk/src/main/java/org/apache/mailet/MailetContext.java

Author: norman
Date: Thu Jan 20 19:30:54 2011
New Revision: 1061472

URL: http://svn.apache.org/viewvc?rev=1061472&view=rev
Log:
Add new logging methods to MailetContext which allows to specify the loglevel to use. Also mark old log methods as @deprecated. See MAILET-33

Modified:
    james/mailet/api/trunk/src/main/java/org/apache/mailet/MailetContext.java

Modified: james/mailet/api/trunk/src/main/java/org/apache/mailet/MailetContext.java
URL: http://svn.apache.org/viewvc/james/mailet/api/trunk/src/main/java/org/apache/mailet/MailetContext.java?rev=1061472&r1=1061471&r2=1061472&view=diff
==============================================================================
--- james/mailet/api/trunk/src/main/java/org/apache/mailet/MailetContext.java (original)
+++ james/mailet/api/trunk/src/main/java/org/apache/mailet/MailetContext.java Thu Jan 20 19:30:54 2011
@@ -57,6 +57,18 @@ import javax.mail.internet.MimeMessage;
 public interface MailetContext {
     
     /**
+     * Loglevel for logging operations
+     * 
+     *
+     */
+    public enum LogLevel {
+        DEBUG,
+        INFO,
+        WARN,
+        ERROR
+    }
+    
+    /**
      * Returns the major version number of the Mailet API that this mailet
      * container supports. For example, if the mailet container supports
      * version 1.2 of the Mailet API, this method returns 1.
@@ -147,7 +159,9 @@ public interface MailetContext {
      * the mailet log is specific to the mailet container.
      *
      * @param message the message to be written to the log
+     * @deprecated use {@link #log(String, LogLevel)}
      */
+    @Deprecated
     void log(String message);
 
     /**
@@ -157,9 +171,32 @@ public interface MailetContext {
      *
      * @param message the message to be written to the log
      * @param t the Throwable whose stack trace is to be written to the log
+     * @deprecated use {@link #log(String, Throwable, LogLevel)}
      */
+    @Deprecated
     void log(String message, Throwable t);
     
+    
+    /**
+     * Writes the specified message to a mailet log. The name and type of
+     * the mailet log is specific to the mailet container.
+     *
+     * @param message the message to be written to the log
+     * @param level {@link LogLevel} to use
+     */
+    void log(String message, LogLevel level);
+
+    /**
+     * Writes the specified message to a mailet log, along with the stack
+     * trace of the given Throwable. The name and type of the mailet log
+     * is specific to the mailet container.
+     *
+     * @param message the message to be written to the log
+     * @param t the Throwable whose stack trace is to be written to the log
+     * @param level {@link LogLevel} to use
+     */
+    void log(String message, Throwable t, LogLevel level);
+    
     /**
      * Returns the Postmaster address for this mailet context.
      *