1 18 19 package org.objectweb.util.monolog.wrapper.log4j; 20 21 import org.objectweb.util.monolog.api.BasicLevel; 22 import org.objectweb.util.monolog.api.Level; 23 import org.objectweb.util.monolog.api.LevelFactory; 24 25 31 public class LevelImpl 32 extends org.objectweb.util.monolog.wrapper.common.LevelImpl { 33 34 static public org.apache.log4j.Level convertLevel( 35 org.objectweb.util.monolog.api.Level l) { 36 return org.apache.log4j.Level.toLevel(l.getIntValue()); 37 } 38 39 static public Level getLevel(int value) { 40 if (value >= BasicLevel.FATAL) { 41 return BasicLevel.LEVEL_FATAL; 42 } 43 else if (value >= BasicLevel.ERROR) { 44 return BasicLevel.LEVEL_ERROR; 45 } 46 else if (value >= BasicLevel.WARN) { 47 return BasicLevel.LEVEL_WARN; 48 } 49 else if (value >= BasicLevel.INFO) { 50 return BasicLevel.LEVEL_INFO; 51 } 52 else if (value >= BasicLevel.DEBUG) { 53 return BasicLevel.LEVEL_DEBUG; 54 } 55 else { 56 return BasicLevel.LEVEL_DEBUG; 57 } 58 } 59 60 public LevelImpl(String name, int val) { 61 super(name, val); 62 } 63 64 public LevelImpl(String name, String val, LevelFactory lf) { 65 super(name, val, lf); 66 } 67 68 } 69 | Popular Tags |