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

org.snapscript.studio.agent.log.LogLevel Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package org.snapscript.studio.agent.log;

public enum LogLevel {
   TRACE(0),
   DEBUG(1),
   INFO(2);
   
   private final int level;
   
   private LogLevel(int level){
      this.level = level;
   }
   
   public boolean isTraceEnabled(){
      return level <= TRACE.level;
   }
   
   public boolean isDebugEnabled(){
      return level <= DEBUG.level;
   }
   
   public boolean isInfoEnabled(){
      return level <= INFO.level;
   }
   
   public static LogLevel resolveLevel(String token){
      if(token != null) {
         String match = token.trim();
         LogLevel[] levels = values();
         
         for(LogLevel level : levels){
            String name = level.name();
            
            if(name.equalsIgnoreCase(match)) {
               return level;
            }
         }
      }
      return LogLevel.INFO;
      
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy