Clover coverage report - DNA Site - 1.1
Coverage timestamp: Sun May 2 2004 15:33:21 BST
file stats: LOC: 220   Methods: 17
NCLOC: 84   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
LogkitLogger.java 100% 100% 100% 100%
coverage
 1   
 /*
 2   
  * Copyright (C) The DNA Group. All rights reserved.
 3   
  *
 4   
  * This software is published under the terms of the DNA
 5   
  * Software License version 1.1, a copy of which has been included
 6   
  * with this distribution in the LICENSE.txt file.
 7   
  */
 8   
 package org.codehaus.dna.impl;
 9   
 
 10   
 import org.codehaus.dna.Logger;
 11   
 
 12   
 /**
 13   
  * Logging facade implmentation for Apache Logkit project.
 14   
  * The following lists the mapping between DNA log levels
 15   
  * and LogKit log levels.
 16   
  *
 17   
  * <ul>
 18   
  *   <li>trace ==&gt; debug</li>
 19   
  *   <li>debug ==&gt; debug</li>
 20   
  *   <li>info ==&gt; info</li>
 21   
  *   <li>warn ==&gt; warn</li>
 22   
  *   <li>error ==&gt; error</li>
 23   
  * </ul>
 24   
  *
 25   
  * @version $Revision: 1.2 $ $Date: 2004/05/01 09:51:48 $
 26   
  */
 27   
 public class LogkitLogger
 28   
     implements Logger
 29   
 {
 30   
     /**
 31   
      * The Logkit logger.
 32   
      */
 33   
     private final org.apache.log.Logger m_logger;
 34   
 
 35   
     /**
 36   
      * Create an instance of LogKit logger facade.
 37   
      *
 38   
      * @param logger the logkit logger
 39   
      */
 40  100
     public LogkitLogger( final org.apache.log.Logger logger )
 41   
     {
 42  100
         if( null == logger )
 43   
         {
 44  4
             throw new NullPointerException( "logger" );
 45   
         }
 46  96
         m_logger = logger;
 47   
     }
 48   
 
 49   
     /**
 50   
      * Log a trace message.
 51   
      *
 52   
      * @param message the message
 53   
      */
 54  8
     public void trace( final String message )
 55   
     {
 56  8
         m_logger.debug( message );
 57   
     }
 58   
 
 59   
     /**
 60   
      * Log a trace message with an associated throwable.
 61   
      *
 62   
      * @param message the message
 63   
      * @param throwable the throwable
 64   
      */
 65  8
     public void trace( final String message,
 66   
                        final Throwable throwable )
 67   
     {
 68  8
         m_logger.debug( message, throwable );
 69   
     }
 70   
 
 71   
     /**
 72   
      * Return true if a trace message will be logged.
 73   
      *
 74   
      * @return true if message will be logged
 75   
      */
 76  16
     public boolean isTraceEnabled()
 77   
     {
 78  16
         return m_logger.isDebugEnabled();
 79   
     }
 80   
 
 81   
     /**
 82   
      * Log a debug message.
 83   
      *
 84   
      * @param message the message
 85   
      */
 86  8
     public void debug( final String message )
 87   
     {
 88  8
         m_logger.debug( message );
 89   
     }
 90   
 
 91   
     /**
 92   
      * Log a debug message with an associated throwable.
 93   
      *
 94   
      * @param message the message
 95   
      * @param throwable the throwable
 96   
      */
 97  8
     public void debug( final String message,
 98   
                        final Throwable throwable )
 99   
     {
 100  8
         m_logger.debug( message, throwable );
 101   
     }
 102   
 
 103   
     /**
 104   
      * Return true if a debug message will be logged.
 105   
      *
 106   
      * @return true if message will be logged
 107   
      */
 108  16
     public boolean isDebugEnabled()
 109   
     {
 110  16
         return m_logger.isDebugEnabled();
 111   
     }
 112   
 
 113   
     /**
 114   
      * Log a info message.
 115   
      *
 116   
      * @param message the message
 117   
      */
 118  8
     public void info( final String message )
 119   
     {
 120  8
         m_logger.info( message );
 121   
     }
 122   
 
 123   
     /**
 124   
      * Log a info message with an associated throwable.
 125   
      *
 126   
      * @param message the message
 127   
      * @param throwable the throwable
 128   
      */
 129  8
     public void info( final String message,
 130   
                       final Throwable throwable )
 131   
     {
 132  8
         m_logger.info( message, throwable );
 133   
     }
 134   
 
 135   
     /**
 136   
      * Return true if an info message will be logged.
 137   
      *
 138   
      * @return true if message will be logged
 139   
      */
 140  16
     public boolean isInfoEnabled()
 141   
     {
 142  16
         return m_logger.isInfoEnabled();
 143   
     }
 144   
 
 145   
     /**
 146   
      * Log a warn message.
 147   
      *
 148   
      * @param message the message
 149   
      */
 150  8
     public void warn( final String message )
 151   
     {
 152  8
         m_logger.warn( message );
 153   
     }
 154   
 
 155   
     /**
 156   
      * Log a warn message with an associated throwable.
 157   
      *
 158   
      * @param message the message
 159   
      * @param throwable the throwable
 160   
      */
 161  8
     public void warn( final String message,
 162   
                       final Throwable throwable )
 163   
     {
 164  8
         m_logger.warn( message, throwable );
 165   
     }
 166   
 
 167   
     /**
 168   
      * Return true if a warn message will be logged.
 169   
      *
 170   
      * @return true if message will be logged
 171   
      */
 172  16
     public boolean isWarnEnabled()
 173   
     {
 174  16
         return m_logger.isWarnEnabled();
 175   
     }
 176   
 
 177   
     /**
 178   
      * Log a error message.
 179   
      *
 180   
      * @param message the message
 181   
      */
 182  4
     public void error( final String message )
 183   
     {
 184  4
         m_logger.error( message );
 185   
     }
 186   
 
 187   
     /**
 188   
      * Log a error message with an associated throwable.
 189   
      *
 190   
      * @param message the message
 191   
      * @param throwable the throwable
 192   
      */
 193  4
     public void error( final String message,
 194   
                        final Throwable throwable )
 195   
     {
 196  4
         m_logger.error( message, throwable );
 197   
     }
 198   
 
 199   
     /**
 200   
      * Return true if a error message will be logged.
 201   
      *
 202   
      * @return true if message will be logged
 203   
      */
 204  16
     public boolean isErrorEnabled()
 205   
     {
 206  16
         return m_logger.isErrorEnabled();
 207   
     }
 208   
 
 209   
     /**
 210   
      * Get the child logger with specified name.
 211   
      *
 212   
      * @param name the name of child logger
 213   
      * @return the child logger
 214   
      */
 215  4
     public Logger getChildLogger( final String name )
 216   
     {
 217  4
         return new LogkitLogger( m_logger.getChildLogger( name ) );
 218   
     }
 219   
 }
 220