Clover coverage report - brownies library - 1.0-beta-1
Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00
file stats: LOC: 134   Methods: 17
NCLOC: 81   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
LogLevel.java - 0% 0% 0%
coverage
 1   
 /*
 2   
  * Joey and its relative products are published under the terms
 3   
  * of the Apache Software License.
 4   
  */
 5   
 package org.asyrinx.brownie.core.log;
 6   
 
 7   
 import java.util.HashMap;
 8   
 import java.util.HashSet;
 9   
 import java.util.Map;
 10   
 import java.util.Set;
 11   
 
 12   
 import org.apache.commons.logging.Log;
 13   
 
 14   
 /**
 15   
  * @author Akima
 16   
  */
 17   
 public abstract class LogLevel {
 18   
 
 19   
     /**
 20   
      * Constructor for Level.
 21   
      */
 22  0
     protected LogLevel(int value, String name) {
 23  0
         super();
 24  0
         this.name = name;
 25  0
         this.value = value;
 26  0
         register(this);
 27   
     }
 28   
 
 29   
     private final int value;
 30   
 
 31   
     private final String name;
 32   
 
 33   
     /**
 34   
      * Returns the name.
 35   
      * 
 36   
      * @return String
 37   
      */
 38  0
     public String getName() {
 39  0
         return name;
 40   
     }
 41   
 
 42   
     /**
 43   
      * Returns the value.
 44   
      * 
 45   
      * @return int
 46   
      */
 47  0
     public int getValue() {
 48  0
         return value;
 49   
     }
 50   
 
 51   
     abstract public void write(Log log, Object msg, Throwable t);
 52   
 
 53  0
     public void write(Log log, Object msg) {
 54  0
         write(log, msg, null);
 55   
     }
 56   
 
 57   
     /**
 58   
      * @see java.lang.Object#toString()
 59   
      */
 60  0
     public String toString() {
 61  0
         return name;
 62   
     }
 63   
 
 64  0
     static public Set getLevels() {
 65  0
         return new HashSet(levels);
 66   
     }
 67   
 
 68   
     static private final Set levels = new HashSet();
 69   
 
 70   
     /**
 71   
      * @see java.lang.Object#finalize()
 72   
      */
 73  0
     protected void finalize() throws Throwable {
 74  0
         levels.remove(this);
 75  0
         super.finalize();
 76   
     }
 77   
 
 78   
     static private Map name2Level = new HashMap();
 79   
 
 80  0
     static public void register(LogLevel level) {
 81  0
         levels.add(level);
 82  0
         name2Level.put(level.name, level);
 83   
     }
 84   
 
 85  0
     static public LogLevel findByName(String name) {
 86  0
         return (LogLevel) name2Level.get(name);
 87   
     }
 88   
 
 89  0
     static public LogLevel getLevel(String name) {
 90  0
         return findByName(name);
 91   
     }
 92   
 
 93   
     static public final LogLevel TRACE = new LogLevel(0, "trace") {
 94  0
         public void write(Log log, Object msg, Throwable t) {
 95  0
             log.trace(msg, t);
 96   
         }
 97   
     };
 98   
 
 99   
     static public final LogLevel DEBUG = new LogLevel(1, "debug") {
 100  0
         public void write(Log log, Object msg, Throwable t) {
 101  0
             log.debug(msg, t);
 102   
         }
 103   
     };
 104   
 
 105   
     static public final LogLevel INFO = new LogLevel(2, "info") {
 106  0
         public void write(Log log, Object msg, Throwable t) {
 107  0
             log.info(msg, t);
 108   
         }
 109   
     };
 110   
 
 111   
     static public final LogLevel WARN = new LogLevel(3, "warn") {
 112  0
         public void write(Log log, Object msg, Throwable t) {
 113  0
             log.warn(msg, t);
 114   
         }
 115   
     };
 116   
 
 117   
     static public final LogLevel ERROR = new LogLevel(4, "error") {
 118  0
         public void write(Log log, Object msg, Throwable t) {
 119  0
             log.error(msg, t);
 120   
         }
 121   
     };
 122   
 
 123   
     static public final LogLevel FATAL = new LogLevel(5, "fatal") {
 124  0
         public void write(Log log, Object msg, Throwable t) {
 125  0
             log.fatal(msg, t);
 126   
         }
 127   
     };
 128   
 
 129   
     static public final LogLevel NONE = new LogLevel(5, "none") {
 130  0
         public void write(Log log, Object msg, Throwable t) {
 131   
         }
 132   
     };
 133   
 
 134   
 }