1 18 19 package org.objectweb.util.monolog.wrapper.javaLog ; 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 32 public class LevelImpl 33 extends org.objectweb.util.monolog.wrapper.common.LevelImpl { 34 35 36 39 static public java.util.logging.Level convertLevel(Level l) { 40 return int2Level(l.getIntValue()); 41 } 42 43 static public java.util.logging.Level int2Level(int value) { 44 if ( value>=BasicLevel.FATAL ) { 45 return java.util.logging.Level.SEVERE; 46 47 } else if ( value>=BasicLevel.ERROR ) { 48 return java.util.logging.Level.SEVERE; 49 50 } else if ( value>=BasicLevel.WARN ) { 51 return java.util.logging.Level.WARNING; 52 53 } else if ( value>=BasicLevel.INFO ) { 54 return java.util.logging.Level.INFO; 55 56 } else if ( value>=BasicLevel.DEBUG ) { 57 return java.util.logging.Level.FINEST; 58 59 } else if ( value==BasicLevel.INHERIT) { 60 return null; 61 62 } else { 63 return java.util.logging.Level.FINEST; 64 } 65 } 66 67 70 static public Level getLevel(int value) { 71 if ( value>=BasicLevel.FATAL ) { 72 return BasicLevel.LEVEL_FATAL; 73 74 } else if ( value>=BasicLevel.ERROR ) { 75 return BasicLevel.LEVEL_ERROR; 76 77 } else if ( value>=BasicLevel.WARN ) { 78 return BasicLevel.LEVEL_WARN; 79 80 } else if ( value>=BasicLevel.INFO ) { 81 return BasicLevel.LEVEL_INFO; 82 83 } else if ( value>=BasicLevel.DEBUG ) { 84 return BasicLevel.LEVEL_DEBUG; 85 } else { 86 return BasicLevel.LEVEL_INHERIT; 87 } 88 } 89 90 public LevelImpl(String n, int val) { 91 super(n, val); 92 } 93 94 public LevelImpl(String n, String val, LevelFactory lf) { 95 super(n, val, lf); 96 } 97 } 98 | Popular Tags |