andyLib v0.9.1

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. Each level has a numeric value; the log is written if the log level is high enough (compared with the configuration level). Each level has also a code, that can be retrived with the getCode() method.

Available levels (in ascending order) are:

Version:
2014/04/29
Author:
andynaz

Enum Constant Summary
DEBUG
          Debug level.
ERROR
          Highest level.
FATAL
          Highest level.
FINE
          Lower level.
INFO
          Defaut level.
WARNING
          Warning level.
 
Field Summary
private  String code
          Level code.
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 be 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

FINE

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


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 captured exceptions or other warnings.


ERROR

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


FATAL

public static final Level FATAL
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.

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 be written. A log is written is the log level is higher than the configuration level.

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

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

andyLib v0.9.1

© 2013 andynaz - http://andynaz.altervista.org