1 18 package org.objectweb.util.monolog.wrapper.p6spy; 19 20 import com.p6spy.engine.logging.appender.P6Logger; 21 import com.p6spy.engine.logging.appender.FormattedLogger; 22 import org.objectweb.util.monolog.api.Logger; 23 import org.objectweb.util.monolog.api.BasicLevel; 24 25 30 public class P6SpyLogger 31 extends FormattedLogger 32 implements P6Logger { 33 34 public static int level; 35 public static Logger logger; 36 37 public P6SpyLogger() { 38 level = BasicLevel.DEBUG; 39 } 40 41 44 public void logText(String s) { 45 if (logger == null) { 46 System.out.println(s); 47 } else if (logger.isLoggable(level)) { 48 logger.log(level, s); 49 } 50 } 51 52 53 56 public void logException(Exception e) { 57 if (logger == null) { 58 e.printStackTrace(System.out); 59 } else if (logger.isLoggable(level)) { 60 logger.log(level, e.getMessage(), e); 61 } 62 } 63 } 64 | Popular Tags |