it.andynaz.log
Enum Level

java.lang.Object
  extended by java.lang.Enum<Level>
      extended by it.andynaz.log.Level
All Implemented Interfaces:
Serializable, Comparable<Level>

public enum Level
extends Enum<Level>

Levels for logs (and configurations).

Each level has a numeric value; the log is written if the log level is high enough (compared with the configuration level).

Available levels (in ascending order) are:

Version:
2013/01/14
Author:
andynaz

Enum Constant Summary
DEBUG
          Debug level.
FINE
          Low level
FINEST
          Lower level.
INFO
          Defaut level.
SEVERE
          Highest level.
WARNING
          Warning level.
 
Field Summary
private  String code
          Level code (used in logging).
private  int level
          Numeric value of the level.
 
Method Summary
 String getCode()
          Returns the code of this level.
 boolean hasToLog(Level logLevel)
          Test if a log has to e written.
static Level valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Level[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

FINEST

public static final Level FINEST
Lower level. A configuration with this level let you log every event.


FINE

public static final Level FINE
Low level


DEBUG

public static final Level DEBUG
Debug level. Used to check for problems during development.


INFO

public static final Level INFO
Defaut level.


WARNING

public static final Level WARNING
Warning level. Should be user for capterued exceptions.


SEVERE

public static final Level SEVERE
Highest level. Used for serious problems (like an exit condition for the program).

Field Detail

level

private int level
Numeric value of the level.


code

private String code
Level code (used in logging).

Method Detail

values

public static Level[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Level c : Level.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Level valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getCode

public String getCode()
Returns the code of this level.

Returns:
the code of this level

hasToLog

public boolean hasToLog(Level logLevel)
Test if a log has to e written. A log is written is the log level is higher than the configuration level.

This method should be invoked on the configuration level, having like argument the log level.

Parameters:
logLevel - event level
Returns:
true if the log has to e logger, false otherwise


(c) 2013 andynaz - http://andynaz.altervista.org