package sbt_inc;

import org.apache.maven.plugin.logging.Log;
import sbt.util.Level;
import sbt.util.Logger;
import scala.Enumeration;
import scala.Function0;

public class SbtLogger extends Logger {

    private final Log log;

    SbtLogger(Log l) {
        this.log = l;
    }

    @Override
    public void trace(Function0<Throwable> t) {
        if (log.isDebugEnabled()) {
            log.debug(t.apply());
        }
    }

    @Override
    public void success(Function0<String> message) {
        if (log.isInfoEnabled()) {
            log.info("Success: " + message.apply());
        }
    }

    @Override
    public void log(Enumeration.Value level, Function0<String> message) {
        if (level.equals(Level.Error())) {
            log.error(message.apply());
        } else if (level.equals(Level.Warn())) {
            log.warn(message.apply());
        } else if (level.equals(Level.Info())) {
            log.info(message.apply());
        } else if (level.equals(Level.Debug())) {
            log.debug(message.apply());
        }
    }
}

@@ -675,32 +675,247 @@
 ing%3E message) %7B%0A
+        String s = message.apply();%0A        String prefix = %22%5B%22 + level.toString() + %22%5D %22;%0A        if (s.regionMatches(true, 0, prefix, 0, prefix.length())) %7B%0A            s = s.substring(prefix.length());%0A        %7D%0A
         if (leve
@@ -963,31 +963,17 @@
 g.error(
-message.apply()
+s
 );%0A     
@@ -1037,31 +1037,17 @@
 og.warn(
-message.apply()
+s
 );%0A     
@@ -1111,31 +1111,17 @@
 og.info(
-message.apply()
+s
 );%0A     
@@ -1187,31 +1187,17 @@
 g.debug(
-message.apply()
+s
 );%0A     

Remove log-level prefix from incoming Sbt log messages