Package com.danga.MemCached
Class Logger
java.lang.Object
com.danga.MemCached.Logger
This is a generic logger class for use in logging.
This can easily be swapped out for any other logging package in the main code.
For now, this is just a quick and dirty logger which will allow you to specify
log levels, but only wraps system.out.println.
- Version:
- 1.5
- Author:
- Greg Whalin <greg@meetup.com>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate intstatic final intstatic final intstatic final intstatic final intstatic final intprivate String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidlogs a debug mesgvoidvoidlogs error mesgvoidvoidlogs fatal mesgintgetLevel()static LoggerGets a Logger obj for given name and sets default level.static LoggerGets a Logger obj for given name and level.voidvoidlogs info mesgbooleanbooleanprivate voidlogs mesg to std out and prints stack trace if exception passed invoidsetLevel(int level) voidvoidlogs warn mesg
-
Field Details
-
LEVEL_DEBUG
public static final int LEVEL_DEBUG- See Also:
-
LEVEL_INFO
public static final int LEVEL_INFO- See Also:
-
LEVEL_WARN
public static final int LEVEL_WARN- See Also:
-
LEVEL_ERROR
public static final int LEVEL_ERROR- See Also:
-
LEVEL_FATAL
public static final int LEVEL_FATAL- See Also:
-
loggers
-
name
-
level
private int level -
initialized
private boolean initialized
-
-
Constructor Details
-
Logger
-
Logger
-
-
Method Details
-
setLevel
public void setLevel(int level) -
getLevel
public int getLevel() -
getLogger
Gets a Logger obj for given name and level.- Parameters:
name-level-- Returns:
-
getLogger
Gets a Logger obj for given name and sets default level.- Parameters:
name-- Returns:
-
log
logs mesg to std out and prints stack trace if exception passed in- Parameters:
mesg-ex-
-
debug
logs a debug mesg- Parameters:
mesg-ex-
-
debug
-
isDebugEnabled
public boolean isDebugEnabled() -
info
logs info mesg- Parameters:
mesg-ex-
-
info
-
isInfoEnabled
public boolean isInfoEnabled() -
warn
logs warn mesg- Parameters:
mesg-ex-
-
warn
-
error
logs error mesg- Parameters:
mesg-ex-
-
error
-
fatal
logs fatal mesg- Parameters:
mesg-ex-
-
fatal
-