1 22 package org.jboss.logging; 23 24 import org.apache.log4j.Level; 25 26 42 public class XLevel 43 extends Level 44 { 45 46 public static final int TRACE_INT = Level.DEBUG_INT - 100; 47 48 49 public static final String TRACE_STR = "TRACE"; 50 51 52 public static final XLevel TRACE = new XLevel(TRACE_INT, TRACE_STR, 7); 53 54 57 protected XLevel(final int level, final String strLevel, final int syslogEquiv) 58 { 59 super(level, strLevel, syslogEquiv); 60 } 61 62 63 67 73 public static Level toLevel(final String name, final Level defaultLevel) 74 { 75 if (name == null) 76 return defaultLevel; 77 78 String upper = name.toUpperCase(); 79 if (upper.equals(TRACE_STR)) { 80 return TRACE; 81 } 82 83 return Level.toLevel(name, defaultLevel); 84 } 85 86 91 public static Level toLevel(final String name) 92 { 93 return toLevel(name, TRACE); 94 } 95 96 101 public static Level toLevel(int i) 102 { 103 return toLevel(i, TRACE); 104 } 105 106 112 public static Level toLevel(final int i, final Level defaultLevel) 113 { 114 Level p; 115 if (i == TRACE_INT) 116 p = TRACE; 117 else 118 p = Level.toLevel(i); 119 return p; 120 } 121 } 122 | Popular Tags |