logback-android/src/main/java/ch/qos/logback/classic/Level.java
public static Level toLevel(int val, Level defaultLevel) {
    switch (val) {
      case ALL_INT:
        return ALL;
      case TRACE_INT:
        return TRACE;
      case DEBUG_INT:
        return DEBUG;
      case INFO_INT:
        return INFO;
      case WARN_INT:
        return WARN;
      case ERROR_INT:
        return ERROR;
      case OFF_INT:
        return OFF;
      default:
        return defaultLevel;
    }
  }
public static Level toLevel(int val, Level defaultLevel) {
    switch (val) {
      case ALL_INT:
        return ALL;
      case TRACE_INT:
        return TRACE;
      case DEBUG_INT:
        return DEBUG;
      case INFO_INT:
        return INFO;
      case WARN_INT:
        return WARN;
      case ERROR_INT:
        return ERROR;
      case OFF_INT:
        return OFF;
      default:
        return defaultLevel;
    }
  }
Convert an integer passed as argument to a Level. If the conversion fails,
then this method returns the specified default.
@param val integer to be evaluated
@param defaultLevel default level if val could not be converted
@return the corresponding level