All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala_maven_executions.LogProcessorUtils Maven / Gradle / Ivy

Go to download

The scala-maven-plugin (previously maven-scala-plugin) is used for compiling/testing/running/documenting scala code of any maven project.

There is a newer version: 4.9.2
Show newest version
package scala_maven_executions;

public class LogProcessorUtils {

  public static enum Level {
    ERROR, WARNING, INFO
  }

  public static class LevelState {
    public Level level = Level.INFO;
    public String untilContains = null;
  }

  public static LevelState levelStateOf(String line, LevelState previous) throws Exception {
    LevelState back = new LevelState();
    String lineLowerCase = line.toLowerCase();
    if (lineLowerCase.indexOf("error") > -1) {
      back.level = Level.ERROR;
      if (lineLowerCase.contains(".scala")) {
        back.untilContains = "^";
      }
    } else if (lineLowerCase.indexOf("warn") > -1) {
      back.level = Level.WARNING;
      if (lineLowerCase.contains(".scala")) {
        back.untilContains = "^";
      }
    } else if (previous.untilContains != null) {
      if (!lineLowerCase.contains(previous.untilContains)) {
        back = previous;
      } else {
        back.level = previous.level;
        back.untilContains = null;
      }
    }
    return back;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy