SHARE
TWEET

Untitled

a guest Jan 18th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package whatever;
  2.  
  3. import org.mongodb.morphia.logging.Logger;
  4. import org.mongodb.morphia.logging.LoggerFactory;
  5. import org.mongodb.morphia.logging.MorphiaLoggerFactory;
  6.  
  7. public class MorphiaLogger implements Logger {
  8.  
  9.     private final org.slf4j.Logger logger;
  10.  
  11.     static {
  12.         MorphiaLoggerFactory.reset();
  13.         MorphiaLoggerFactory.registerLogger(MorphiaLoggerFactoryImpl.class);
  14.     }
  15.  
  16.     public MorphiaLogger(Class<?> aClass) {
  17.         this.logger = org.slf4j.LoggerFactory.getLogger(aClass);
  18.     }
  19.  
  20.     @Override
  21.     public void debug(String s) {
  22.         logger.debug(s);
  23.     }
  24.  
  25.     @Override
  26.     public void debug(String s, Object... objects) {
  27.         logger.debug(s, objects);
  28.     }
  29.  
  30.     @Override
  31.     public void debug(String s, Throwable throwable) {
  32.         logger.debug(s, throwable);
  33.     }
  34.  
  35.     @Override
  36.     public void error(String s) {
  37.         logger.error(s);
  38.     }
  39.  
  40.     @Override
  41.     public void error(String s, Object... objects) {
  42.         logger.error(s, objects);
  43.     }
  44.  
  45.     @Override
  46.     public void error(String s, Throwable throwable) {
  47.         logger.error(s, throwable);
  48.     }
  49.  
  50.     @Override
  51.     public void info(String s) {
  52.         logger.info(s);
  53.     }
  54.  
  55.     @Override
  56.     public void info(String s, Object... objects) {
  57.         logger.info(s, objects);
  58.     }
  59.  
  60.     @Override
  61.     public void info(String s, Throwable throwable) {
  62.         logger.info(s, throwable);
  63.     }
  64.  
  65.     @Override
  66.     public boolean isDebugEnabled() {
  67.         return false;
  68.     }
  69.  
  70.     @Override
  71.     public boolean isErrorEnabled() {
  72.         return true;
  73.     }
  74.  
  75.     @Override
  76.     public boolean isInfoEnabled() {
  77.         return true;
  78.     }
  79.  
  80.     @Override
  81.     public boolean isTraceEnabled() {
  82.         return true;
  83.     }
  84.  
  85.     @Override
  86.     public boolean isWarningEnabled() {
  87.         return true;
  88.     }
  89.  
  90.     @Override
  91.     public void trace(String s) {
  92.         logger.trace(s);
  93.     }
  94.  
  95.     @Override
  96.     public void trace(String s, Object... objects) {
  97.         logger.trace(s, objects);
  98.     }
  99.  
  100.     @Override
  101.     public void trace(String s, Throwable throwable) {
  102.         logger.trace(s, throwable);
  103.     }
  104.  
  105.     @Override
  106.     public void warning(String s) {
  107.         logger.warn(s);
  108.     }
  109.  
  110.     @Override
  111.     public void warning(String s, Object... objects) {
  112.         logger.warn(s, objects);
  113.     }
  114.  
  115.     @Override
  116.     public void warning(String s, Throwable throwable) {
  117.         logger.warn(s, throwable);
  118.     }
  119.  
  120.     public static class MorphiaLoggerFactoryImpl implements LoggerFactory {
  121.         @Override
  122.         public Logger get(Class<?> aClass) {
  123.             return new MorphiaLogger(aClass);
  124.         }
  125.     }
  126. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top