Clover coverage report - DNA - 1.0
Coverage timestamp: Sun Oct 12 2003 11:23:26 BST
file stats: LOC: 223   Methods: 17
NCLOC: 87   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
Jdk14Logger.java 100% 100% 100% 100%
coverage
 1   
 /*
 2   
  * Copyright (C) The JContainer Group. All rights reserved.
 3   
  *
 4   
  * This software is published under the terms of the JContainer
 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.jcontainer.dna.impl;
 9   
 
 10   
 import java.util.logging.Level;
 11   
 import org.jcontainer.dna.Logger;
 12   
 
 13   
 /**
 14   
  * Logging facade implmentation for JDK1.4 logging toolkit.
 15   
  * The following lists the mapping between DNA log levels
 16   
  * and JDK1.4 log levels.
 17   
  *
 18   
  * <ul>
 19   
  *   <li>trace ==&gt; finest</li>
 20   
  *   <li>debug ==&gt; fine</li>
 21   
  *   <li>info ==&gt; info</li>
 22   
  *   <li>warn ==&gt; warning</li>
 23   
  *   <li>error ==&gt; severe</li>
 24   
  * </ul>
 25   
  *
 26   
  * @version $Revision: 1.5 $ $Date: 2003/09/23 10:15:26 $
 27   
  */
 28   
 public class Jdk14Logger
 29   
     implements Logger
 30   
 {
 31   
     /**
 32   
      * The JDK1.4 logger.
 33   
      */
 34   
     private final java.util.logging.Logger m_logger;
 35   
 
 36   
     /**
 37   
      * Create an instance of JDK14Logger facade.
 38   
      *
 39   
      * @param logger the JDK1.4 logger.
 40   
      */
 41  51
     public Jdk14Logger( final java.util.logging.Logger logger )
 42   
     {
 43  51
         if( null == logger )
 44   
         {
 45  2
             throw new NullPointerException( "logger" );
 46   
         }
 47  49
         m_logger = logger;
 48   
     }
 49   
 
 50   
     /**
 51   
      * Log a trace message.
 52   
      *
 53   
      * @param message the message
 54   
      */
 55  4
     public void trace( final String message )
 56   
     {
 57  4
         m_logger.log( Level.FINEST, message );
 58   
     }
 59   
 
 60   
     /**
 61   
      * Log a trace message with an associated throwable.
 62   
      *
 63   
      * @param message the message
 64   
      * @param throwable the throwable
 65   
      */
 66  4
     public void trace( final String message,
 67   
                        final Throwable throwable )
 68   
     {
 69  4
         m_logger.log( Level.FINEST, message, throwable );
 70   
     }
 71   
 
 72   
     /**
 73   
      * Return true if a trace message will be logged.
 74   
      *
 75   
      * @return true if message will be logged
 76   
      */
 77  8
     public boolean isTraceEnabled()
 78   
     {
 79  8
         return m_logger.isLoggable( Level.FINEST );
 80   
     }
 81   
 
 82   
     /**
 83   
      * Log a debug message.
 84   
      *
 85   
      * @param message the message
 86   
      */
 87  4
     public void debug( final String message )
 88   
     {
 89  4
         m_logger.log( Level.FINE, message );
 90   
     }
 91   
 
 92   
     /**
 93   
      * Log a debug message with an associated throwable.
 94   
      *
 95   
      * @param message the message
 96   
      * @param throwable the throwable
 97   
      */
 98  4
     public void debug( final String message,
 99   
                        final Throwable throwable )
 100   
     {
 101  4
         m_logger.log( Level.FINE, message, throwable );
 102   
     }
 103   
 
 104   
     /**
 105   
      * Return true if a debug message will be logged.
 106   
      *
 107   
      * @return true if message will be logged
 108   
      */
 109  8
     public boolean isDebugEnabled()
 110   
     {
 111  8
         return m_logger.isLoggable( Level.FINE );
 112   
     }
 113   
 
 114   
     /**
 115   
      * Log a info message.
 116   
      *
 117   
      * @param message the message
 118   
      */
 119  4
     public void info( final String message )
 120   
     {
 121  4
         m_logger.log( Level.INFO, message );
 122   
     }
 123   
 
 124   
     /**
 125   
      * Log a info message with an associated throwable.
 126   
      *
 127   
      * @param message the message
 128   
      * @param throwable the throwable
 129   
      */
 130  4
     public void info( final String message,
 131   
                       final Throwable throwable )
 132   
     {
 133  4
         m_logger.log( Level.INFO, message, throwable );
 134   
     }
 135   
 
 136   
     /**
 137   
      * Return true if an info message will be logged.
 138   
      *
 139   
      * @return true if message will be logged
 140   
      */
 141  8
     public boolean isInfoEnabled()
 142   
     {
 143  8
         return m_logger.isLoggable( Level.INFO );
 144   
     }
 145   
 
 146   
     /**
 147   
      * Log a warn message.
 148   
      *
 149   
      * @param message the message
 150   
      */
 151  4
     public void warn( final String message )
 152   
     {
 153  4
         m_logger.log( Level.WARNING, message );
 154   
     }
 155   
 
 156   
     /**
 157   
      * Log a warn message with an associated throwable.
 158   
      *
 159   
      * @param message the message
 160   
      * @param throwable the throwable
 161   
      */
 162  4
     public void warn( final String message,
 163   
                       final Throwable throwable )
 164   
     {
 165  4
         m_logger.log( Level.WARNING, message, throwable );
 166   
     }
 167   
 
 168   
     /**
 169   
      * Return true if a warn message will be logged.
 170   
      *
 171   
      * @return true if message will be logged
 172   
      */
 173  8
     public boolean isWarnEnabled()
 174   
     {
 175  8
         return m_logger.isLoggable( Level.WARNING );
 176   
     }
 177   
 
 178   
     /**
 179   
      * Log a error message.
 180   
      *
 181   
      * @param message the message
 182   
      */
 183  2
     public void error( final String message )
 184   
     {
 185  2
         m_logger.log( Level.SEVERE, message );
 186   
     }
 187   
 
 188   
     /**
 189   
      * Log a error message with an associated throwable.
 190   
      *
 191   
      * @param message the message
 192   
      * @param throwable the throwable
 193   
      */
 194  2
     public void error( final String message,
 195   
                        final Throwable throwable )
 196   
     {
 197  2
         m_logger.log( Level.SEVERE, message, throwable );
 198   
     }
 199   
 
 200   
     /**
 201   
      * Return true if a error message will be logged.
 202   
      *
 203   
      * @return true if message will be logged
 204   
      */
 205  8
     public boolean isErrorEnabled()
 206   
     {
 207  8
         return m_logger.isLoggable( Level.SEVERE );
 208   
     }
 209   
 
 210   
     /**
 211   
      * Get the child logger with specified name.
 212   
      *
 213   
      * @param name the name of child logger
 214   
      * @return the child logger
 215   
      */
 216  2
     public Logger getChildLogger( final String name )
 217   
     {
 218  2
         final String childName = m_logger.getName() + "." + name;
 219  2
         return new Jdk14Logger( java.util.logging.
 220   
                                 Logger.getLogger( childName ) );
 221   
     }
 222   
 }
 223