Package org.jmol.util
Class Logger
- java.lang.Object
-
- org.jmol.util.Logger
-
public final class Logger extends Object
Logger mechanism.
-
-
Field Summary
Fields Modifier and Type Field Description private static boolean[]_activeLevelsprivate static LoggerInterface_loggerprivate static boolean_logLevelstatic booleandebuggingstatic booleandebuggingHigh(package private) static Map<String,Long>htTimingstatic intLEVEL_DEBUGstatic intLEVEL_DEBUGHIGHstatic intLEVEL_ERRORstatic intLEVEL_FATALstatic intLEVEL_INFOstatic intLEVEL_MAXstatic intLEVEL_WARN
-
Constructor Summary
Constructors Modifier Constructor Description privateLogger()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckMemory()static intcheckTimer(String msg, boolean andReset)static voiddebug(String txt)Writes a log at DEBUG level.static voiddoLogLevel(boolean log)Indicates if the level is logged.static voiderror(String txt)Writes a log at ERROR level.static voiderrorEx(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 voidfatalEx(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 intgetLogLevel()private static booleangetProperty(String level, boolean defaultValue)private static intgetTimeFrom(String msg)static StringgetTimerMsg(String msg, int time)static voidinfo(String txt)og* 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 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(String msg)static voidwarn(String txt)Writes a log at WARN level.static voidwarnEx(String txt, Throwable e)Writes a log at WARN level with detail on exception.
-
-
-
Field Detail
-
_logger
private static LoggerInterface _logger
-
LEVEL_FATAL
public static final int LEVEL_FATAL
- See Also:
- Constant Field Values
-
LEVEL_ERROR
public static final int LEVEL_ERROR
- See Also:
- Constant Field Values
-
LEVEL_WARN
public static final int LEVEL_WARN
- See Also:
- Constant Field Values
-
LEVEL_INFO
public static final int LEVEL_INFO
- See Also:
- Constant Field Values
-
LEVEL_DEBUG
public static final int LEVEL_DEBUG
- See Also:
- Constant Field Values
-
LEVEL_DEBUGHIGH
public static final int LEVEL_DEBUGHIGH
- See Also:
- Constant Field Values
-
LEVEL_MAX
public static final int LEVEL_MAX
- See Also:
- Constant Field Values
-
_activeLevels
private static final boolean[] _activeLevels
-
_logLevel
private static boolean _logLevel
-
debugging
public static boolean debugging
-
debuggingHigh
public static boolean debuggingHigh
-
-
Method Detail
-
getProperty
private static boolean getProperty(String level, boolean defaultValue)
-
setLogger
public static void setLogger(LoggerInterface logger)
Replaces the current logger implementation by a new one.- Parameters:
logger- New logger implementation.
-
isActiveLevel
public static boolean isActiveLevel(int level)
Tells if a logging level is active.- Parameters:
level- Logging level.- Returns:
- Active.
-
setActiveLevel
public static void setActiveLevel(int level, boolean active)Changes the activation state for a logging level.- Parameters:
level- Level.active- New activation state.
-
setLogLevel
public static void setLogLevel(int level)
Activates all logging levels up through a given level.- Parameters:
level-
-
getLevel
public static String getLevel(int level)
Returns the text corresponding to a level.- Parameters:
level- Level.- Returns:
- Corresponding text.
-
logLevel
public static boolean logLevel()
Indicates if the level is logged.- Returns:
- Indicator.
-
doLogLevel
public static void doLogLevel(boolean log)
Indicates if the level is logged.- Parameters:
log- Indicator.
-
debug
public static void debug(String txt)
Writes a log at DEBUG level.- Parameters:
txt- String to write.
-
info
public static void info(String txt)
og* Writes a log at INFO level.- Parameters:
txt- String to write.
-
warn
public static void warn(String txt)
Writes a log at WARN level.- Parameters:
txt- String to write.
-
warnEx
public static void warnEx(String txt, Throwable e)
Writes a log at WARN level with detail on exception.- Parameters:
txt- String to write.e- Exception.
-
error
public static void error(String txt)
Writes a log at ERROR level.- Parameters:
txt- String to write.
-
errorEx
public static void errorEx(String txt, Throwable e)
Writes a log at ERROR level with detail on exception.- Parameters:
txt- String to write.e- Exception.
-
getLogLevel
public static int getLogLevel()
-
fatal
public static void fatal(String txt)
Writes a log at FATAL level.- Parameters:
txt- String to write.
-
fatalEx
public static void fatalEx(String txt, Throwable e)
Writes a log at FATAL level with detail on exception.- Parameters:
txt- String to write.e- Exception.
-
startTimer
public static void startTimer(String msg)
-
getTimeFrom
private static int getTimeFrom(String msg)
-
checkTimer
public static int checkTimer(String msg, boolean andReset)
-
checkMemory
public static void checkMemory()
-
-