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

com.undefinedlabs.scope.logger.ScopeLoggerLevel Maven / Gradle / Ivy

package com.undefinedlabs.scope.logger;

import org.apache.commons.lang3.StringUtils;

public enum ScopeLoggerLevel {
  ERROR("error"),
  WARN("warn"),
  INFO("info"),
  DEBUG("debug"),
  TRACE("trace");

  private final String level;

  ScopeLoggerLevel(final String level) {
    this.level = level;
  }

  public static ScopeLoggerLevel fromString(final String str) {
    if (StringUtils.isEmpty(str)) {
      return INFO;
    }

    for (final ScopeLoggerLevel levelEnum : ScopeLoggerLevel.values()) {
      if (levelEnum.level.equalsIgnoreCase(str.trim())) {
        return levelEnum;
      }
    }

    return INFO;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy