avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-logkit/src/java/org/apache/log/format PatternFormatter.java
Date Thu, 13 Dec 2001 08:04:51 GMT
donaldp     01/12/13 00:04:51

  Modified:    src/java/org/apache/log/format PatternFormatter.java
  Log:
  Added a getRTime() method to format relative time. Just delegates to getTime at the moment
for backwards compatability.
  
  Submitted By: Jeremias Maerki <jeremias.maerki@outline.ch>
  
  Revision  Changes    Path
  1.24      +14 -2     jakarta-avalon-logkit/src/java/org/apache/log/format/PatternFormatter.java
  
  Index: PatternFormatter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-logkit/src/java/org/apache/log/format/PatternFormatter.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- PatternFormatter.java	2001/12/13 07:58:04	1.23
  +++ PatternFormatter.java	2001/12/13 08:04:51	1.24
  @@ -73,7 +73,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
  - * @version CVS $Revision: 1.23 $ $Date: 2001/12/13 07:58:04 $
  + * @version CVS $Revision: 1.24 $ $Date: 2001/12/13 08:04:51 $
    */
   public class PatternFormatter
       implements Formatter, org.apache.log.Formatter
  @@ -411,7 +411,7 @@
       {
           switch( run.m_type )
           {
  -        case TYPE_RELATIVE_TIME: return getTime( event.getRelativeTime(), run.m_format
);
  +        case TYPE_RELATIVE_TIME: return getRTime( event.getRelativeTime(), run.m_format
);
           case TYPE_TIME: return getTime( event.getTime(), run.m_format );
           case TYPE_THROWABLE: return getStackTrace( event.getThrowable(), run.m_format );
           case TYPE_MESSAGE: return getMessage( event.getMessage(), run.m_format );
  @@ -520,6 +520,18 @@
           final StringWriter sw = new StringWriter();
           throwable.printStackTrace( new java.io.PrintWriter( sw ) );
           return sw.toString();
  +    }
  +
  +    /**
  +     * Utility method to format relative time.
  +     *
  +     * @param time the time
  +     * @param format ancilliary format parameter - allowed to be null
  +     * @return the formatted string
  +     */
  +    protected String getRTime( final long time, final String format )
  +    {
  +        return getTime( time, format );
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message