Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Logback: the reliable, generic, fast and flexible logging framework. Copyright (C) 1999-2011, QOS.ch. All rights reserved. This program and the accompanying materials are dual-licensed under either the terms of the Eclipse Public License v1.0 as published by the Eclipse Foundation or (per the licensee's choosing) under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.
 
 package ch.qos.logback.classic;
 
Defines the set of levels recognized by logback-classic, that is OFF, ERROR, WARN, INFO, DEBUG, TRACE and ALL.

The Level class is final and cannot be sub-classed.

 
 public final class Level implements java.io.Serializable {
 
   private static final long serialVersionUID = -814092767334282137L;
 
   public static final int OFF_INT = .;
   public static final int ERROR_INT = 40000;
   public static final int WARN_INT = 30000;
   public static final int INFO_INT = 20000;
   public static final int DEBUG_INT = 10000;
   public static final int TRACE_INT = 5000;
   public static final int ALL_INT = .;
 
   public static final Integer OFF_INTEGER = ;
   public static final Integer ERROR_INTEGER = ;
   public static final Integer WARN_INTEGER = ;
   public static final Integer INFO_INTEGER = ;
   public static final Integer DEBUG_INTEGER = ;
   public static final Integer TRACE_INTEGER = ;
   public static final Integer ALL_INTEGER = ;

  
The OFF is used to turn off logging.
 
   public static final Level OFF = new Level("OFF");

  
The ERROR level designates error events which may or not be fatal to the application.
 
   public static final Level ERROR = new Level("ERROR");

  
The WARN level designates potentially harmful situations.
 
   public static final Level WARN = new Level("WARN");

  
The INFO level designates informational messages highlighting overall progress of the application.
 
   public static final Level INFO = new Level("INFO");

  
The DEBUG level designates informational events of lower importance.
 
   public static final Level DEBUG = new Level("DEBUG");

  
The TRACE level designates informational events of very low importance.
 
   public static final Level TRACE = new Level("TRACE");

  
The ALL is used to turn on all logging.
 
   public static final Level ALL = new Level("ALL");
 
   public final int levelInt;
   public final String levelStr;

  
Instantiate a Level object.
 
   private Level(int levelIntString levelStr) {
     this. = levelInt;
     this. = levelStr;
   }

  
Returns the string representation of this Level.
 
   public String toString() {
     return ;
  }

  
Returns the integer representation of this Level.
  public int toInt() {
    return ;
  }

  
Convert a Level to an Integer object.

Returns:
This level's Integer mapping.
  public Integer toInteger() {
    switch () {
      case :
        return ;
      case :
        return ;
      case :
        return ;
      case :
        return ;
      case :
        return ;
      case :
        return ;
      case :
        return ;
      default:
        throw new IllegalStateException("Level " +  + ", " + 
                + " is unknown.");
    }
  }

  
Returns true if this Level has a higher or equal Level than the Level passed as argument, false otherwise.
  public boolean isGreaterOrEqual(Level r) {
    return  >= r.levelInt;
  }

  
Convert the string passed as argument to a Level. If the conversion fails, then this method returns DEBUG.
  public static Level toLevel(String sArg) {
    return toLevel(sArg.);
  }


  
This method exists in order to comply with Joran's valueOf convention.

Parameters:
sArg
Returns:
  public static Level valueOf(String sArg) {
    return toLevel(sArg.);
  }


  
Convert an integer passed as argument to a Level. If the conversion fails, then this method returns DEBUG.
  public static Level toLevel(int val) {
    return toLevel(val.);
  }

  
Convert an integer passed as argument to a Level. If the conversion fails, then this method returns the specified default.
  public static Level toLevel(int valLevel defaultLevel) {
    switch (val) {
      case :
        return ;
      case :
        return ;
      case :
        return ;
      case :
        return ;
      case :
        return ;
      case :
        return ;
      case :
        return ;
      default:
        return defaultLevel;
    }
  }

  
Convert the string passed as argument to a Level. If the conversion fails, then this method returns the value of defaultLevel.
  public static Level toLevel(String sArgLevel defaultLevel) {
    if (sArg == null) {
      return defaultLevel;
    }
    if (sArg.equalsIgnoreCase("ALL")) {
      return .;
    }
    if (sArg.equalsIgnoreCase("TRACE")) {
      return .;
    }
    if (sArg.equalsIgnoreCase("DEBUG")) {
      return .;
    }
    if (sArg.equalsIgnoreCase("INFO")) {
      return .;
    }
    if (sArg.equalsIgnoreCase("WARN")) {
      return .;
    }
    if (sArg.equalsIgnoreCase("ERROR")) {
      return .;
    }
    if (sArg.equalsIgnoreCase("OFF")) {
      return .;
    }
    return defaultLevel;
  }

  
Return the flyweight instance of the level received through serizalization, i.e. 'this'.

Returns:
The appropriate flyweight instance
  private Object readResolve() {
    return toLevel(this.);
  }

  
Convert one of the integer values defined in org.slf4j.spi.LocationAwareLogger interface to an instance of this class, i.e. a Level.

Parameters:
levelInt An integer value representing a level as defined in LocationAwareLogger
Returns:
an instance of this class, i.e. a Level.
Since:
1.0.1
  public static Level fromLocationAwareLoggerInteger(int levelInt) {
    Level level;
    switch (levelInt) {
        level = ;
        break;
        level = ;
        break;
      case .:
        level = ;
        break;
      case .:
        level = ;
        break;
        level = ;
        break;
      default:
        throw new IllegalArgumentException(levelInt + " not a valid level value");
    }
    return level;
  }

  
Convert this level instance to an integer value defined in the org.slf4j.spi.LocationAwareLogger interface.

Parameters:
level The level to convert to LocationAwareLogger integer
Returns:
int An integer corresponding to this level as defined in LocationAwareLogger
Since:
1.0.1
  public int toLocationAwareLoggerInteger(Level level) {
    if (level == null)
      throw new IllegalArgumentException("null level parameter is not admitted");
    switch (level.toInt()) {
      case .:
        return .;
      case .:
        return .;
      case .:
        return .;
      case .:
        return .;
      case .:
        return .;
      default:
        throw new IllegalArgumentException(level + " not a valid level value");
    }
  }
New to GrepCode? Check out our FAQ X