org.jmol.util

Class Logger

public final class Logger extends Object

Logger mechanism.
Field Summary
static booleandebugging
static intLEVEL_DEBUG
static intLEVEL_DEBUGHIGH
static intLEVEL_ERROR
static intLEVEL_FATAL
static intLEVEL_INFO
static intLEVEL_MAX
static intLEVEL_WARN
static longstartTime
static boolean[]_activeLevels
static LoggerInterface_logger
static boolean_logLevel
Method Summary
static longcheckTimer(String msg)
static voiddebug(String txt)
Writes a log at DEBUG level.
static voiderror(String txt)
Writes a log at ERROR level.
static voiderror(String txt, Throwable e)
Writes a log at ERROR level with detail on exception.
static voidfatal(String txt)
Writes a log at FATAL level.
static voidfatal(String txt, Throwable e)
Writes a log at FATAL level with detail on exception.
static StringgetLevel(int level)
Returns the text corresponding to a level.
static booleangetProperty(String level, boolean defaultValue)
static voidinfo(String txt)
Writes a log at INFO level.
static booleanisActiveLevel(int level)
Tells if a logging level is active.
static booleanlogLevel()
Indicates if the level is logged.
static voidlogLevel(boolean log)
Indicates if the level is logged.
static voidsetActiveLevel(int level, boolean active)
Changes the activation state for a logging level.
static voidsetLogger(LoggerInterface logger)
Replaces the current logger implementation by a new one.
static voidsetLogLevel(int level)
Activates all logging levels up through a given level.
static voidstartTimer()
static voidwarn(String txt)
Writes a log at WARN level.
static voidwarn(String txt, Throwable e)
Writes a log at WARN level with detail on exception.

Field Detail

debugging

public static boolean debugging

LEVEL_DEBUG

public static final int LEVEL_DEBUG

LEVEL_DEBUGHIGH

public static final int LEVEL_DEBUGHIGH

LEVEL_ERROR

public static final int LEVEL_ERROR

LEVEL_FATAL

public static final int LEVEL_FATAL

LEVEL_INFO

public static final int LEVEL_INFO

LEVEL_MAX

public static final int LEVEL_MAX

LEVEL_WARN

public static final int LEVEL_WARN

startTime

static long startTime

_activeLevels

private static final boolean[] _activeLevels

_logger

private static LoggerInterface _logger

_logLevel

private static boolean _logLevel

Method Detail

checkTimer

public static long checkTimer(String msg)

debug

public static void debug(String txt)
Writes a log at DEBUG level.

Parameters: txt String to write.

error

public static void error(String txt)
Writes a log at ERROR level.

Parameters: txt String to write.

error

public static void error(String txt, Throwable e)
Writes a log at ERROR level with detail on exception.

Parameters: txt String to write. e Exception.

fatal

public static void fatal(String txt)
Writes a log at FATAL level.

Parameters: txt String to write.

fatal

public static void fatal(String txt, Throwable e)
Writes a log at FATAL level with detail on exception.

Parameters: txt String to write. e Exception.

getLevel

public static String getLevel(int level)
Returns the text corresponding to a level.

Parameters: level Level.

Returns: Corresponding text.

getProperty

private static boolean getProperty(String level, boolean defaultValue)

info

public static void info(String txt)
Writes a log at INFO level.

Parameters: txt String to write.

isActiveLevel

public static boolean isActiveLevel(int level)
Tells if a logging level is active.

Parameters: level Logging level.

Returns: Active.

logLevel

public static boolean logLevel()
Indicates if the level is logged.

Returns: Indicator.

logLevel

public static void logLevel(boolean log)
Indicates if the level is logged.

Parameters: log Indicator.

setActiveLevel

public static void setActiveLevel(int level, boolean active)
Changes the activation state for a logging level.

Parameters: level Level. active New activation state.

setLogger

public static void setLogger(LoggerInterface logger)
Replaces the current logger implementation by a new one.

Parameters: logger New logger implementation.

setLogLevel

public static void setLogLevel(int level)
Activates all logging levels up through a given level.

Parameters: level

startTimer

public static void startTimer()

warn

public static void warn(String txt)
Writes a log at WARN level.

Parameters: txt String to write.

warn

public static void warn(String txt, Throwable e)
Writes a log at WARN level with detail on exception.

Parameters: txt String to write. e Exception.