package net.lightbody.bmp.proxy.util;

import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

public class Log {
    protected Logger logger;
    private String className;

    public Log() {
        Exception e = new Exception();
        className = e.getStackTrace()[1].getClassName();
        logger = Logger.getLogger(className);
    }

    public Log(Class clazz) {
        className = clazz.getName();
        logger = Logger.getLogger(className);
    }

    public void severe(String msg, Throwable e) {
        log(Level.SEVERE, msg, e);
    }

    public void severe(String msg, Object... args) {
        log(Level.SEVERE, msg, args);
    }

    public void severe(String msg, Throwable e, Object... args) {
        log(Level.SEVERE, msg, e, args);
    }

    public RuntimeException severeAndRethrow(String msg, Throwable e, Object... args) {
        log(Level.SEVERE, msg, e, args);

        //noinspection ThrowableInstanceNeverThrown
        return new RuntimeException(new java.util.Formatter().format(msg, args).toString());
    }

    public void warn(String msg, Throwable e) {
        log(Level.WARNING, msg, e);
    }

    public void warn(String msg, Object... args) {
        log(Level.WARNING, msg, args);
    }

    public void warn(String msg, Throwable e, Object... args) {
        log(Level.WARNING, msg, e, args);
    }

    public void info(String msg, Throwable e) {
        log(Level.INFO, msg, e);
    }

    public void info(String msg, Object... args) {
        log(Level.INFO, msg, args);
    }

    public void info(String msg, Throwable e, Object... args) {
        log(Level.INFO, msg, e, args);
    }

    public void fine(String msg, Throwable e) {
        log(Level.FINE, msg, e);
    }

    public void fine(String msg, Object... args) {
        log(Level.FINE, msg, args);
    }

    public void fine(String msg, Throwable e, Object... args) {
        log(Level.FINE, msg, e, args);
    }

    private void log(Level level, String msg, Throwable e) {
        logger.log(level, msg, e);
    }

    private void log(Level level, String msg, Object... args) {
        logger.log(level, msg, args);
    }

    private void log(Level level, String msg, Throwable e, Object... args) {
        LogRecord lr = new LogRecord(level, msg);
        lr.setThrown(e);
        lr.setParameters(args);
        lr.setSourceMethodName("");
        lr.setSourceClassName(className);
        lr.setLoggerName(className);
        logger.log(lr);
    }
}
@@ -43,100 +43,56 @@
 ort 
-java.util.logging.Level;%0Aimport java.util.logging.LogRecord;%0Aimport java.util.logging.Logger
+org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory
 ;%0A%0Ap
@@ -299,32 +299,39 @@
  logger = Logger
+Factory
 .getLogger(class
@@ -434,16 +434,23 @@
 = Logger
+Factory
 .getLogg
@@ -528,39 +528,34 @@
 %0A        log
-(Level.SEVERE, 
+ger.error(
 msg, e);%0A   
@@ -618,39 +618,34 @@
 %0A        log
-(Level.SEVERE, 
+ger.error(
 msg, args);%0A
@@ -724,39 +724,34 @@
 %0A        log
-(Level.SEVERE, 
+ger.error(
 msg, e, args
@@ -863,23 +863,18 @@
  log
-(Level.SEVERE, 
+ger.error(
 msg,
@@ -1096,32 +1096,25 @@
      log
-(Level.WARNING, 
+ger.warn(
 msg, e);
@@ -1183,32 +1183,25 @@
      log
-(Level.WARNING, 
+ger.warn(
 msg, arg
@@ -1290,24 +1290,17 @@
  log
-(Level.WARNING, 
+ger.warn(
 msg,
@@ -1372,37 +1372,33 @@
 %0A        log
-(Level.INFO, 
+ger.info(
 msg, e);%0A   
@@ -1459,37 +1459,33 @@
 %0A        log
-(Level.INFO, 
+ger.info(
 msg, args);%0A
@@ -1570,21 +1570,17 @@
  log
-(Level.INFO, 
+ger.info(
 msg,
@@ -1652,37 +1652,34 @@
 %0A        log
-(Level.FINE, 
+ger.debug(
 msg, e);%0A   
@@ -1740,37 +1740,34 @@
 %0A        log
-(Level.FINE, 
+ger.debug(
 msg, args);%0A
@@ -1852,575 +1852,30 @@
  log
-(Level.FINE, msg, e, args);%0A    %7D%0A%0A    private void log(Level level, String msg, Throwable e) %7B%0A        logger.log(level, msg, e);%0A    %7D%0A%0A    private void log(Level level, String msg, Object... args) %7B%0A        logger.log(level, msg, args);%0A    %7D%0A%0A    private void log(Level level, String msg, Throwable e, Object... args) %7B%0A        LogRecord lr = new LogRecord(level, msg);%0A        lr.setThrown(e);%0A        lr.setParameters(args);%0A        lr.setSourceMethodName(%22%22);%0A        lr.setSourceClassName(className);%0A        lr.setLoggerName(className);%0A        logger.log(lr
+ger.debug(msg, e, args
 );%0A 

Use SLF4J rather than JDK logging directly. This is not a complete solution, since the fork of Jetty we're using is directly tied to commons-logging so we have to clean that up too in order to be 100% on SLF4J