|
The Meta-Environment API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoolbus.logging.CommandLineLogger
public class CommandLineLogger
Logger implementation that writes to the command line / std-err.
Field Summary | |
---|---|
private int |
level
|
private java.io.PrintStream |
printStream
|
private boolean |
timestamp
|
Fields inherited from interface toolbus.logging.ILogger |
---|
ALL, DEBUG, DEBUGSTR, ERROR, ERRORSTR, FATAL, FATALSTR, INFO, INFOSTR, LOG, LOGSTR, OFF, UNKNOWNSTR, WARNING, WARNINGSTR |
Constructor Summary | |
---|---|
CommandLineLogger()
Default constructor. |
|
CommandLineLogger(int level)
Constructor. |
Method Summary | |
---|---|
static java.lang.String |
getFormattedDateTime()
Returns a properly formated string containing the date and time. |
static java.lang.String |
getLogLevelString(int logLevel)
Returns a string containing a string representation of the log level. |
void |
log(java.lang.String message,
int loglevel)
Logs the given message (but only if the message is 'important' enough). |
void |
log(java.lang.String message,
java.lang.Throwable throwable,
int loglevel)
Logs the given message, including the given stacktrace (but only if the message is 'important' enough). |
void |
setTimestamp(boolean on)
Toggle timestamp printing in messages |
private boolean |
shouldLog(int loglevel)
Method for checking if we should log a message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final int level
private final java.io.PrintStream printStream
private boolean timestamp
Constructor Detail |
---|
CommandLineLogger()
CommandLineLogger(int level)
level
- The log level to initialize this logger with.Method Detail |
---|
private boolean shouldLog(int loglevel)
loglevel
- The log level of the message.
public void setTimestamp(boolean on)
ILogger
setTimestamp
in interface ILogger
on
- Sets timestamp on or off.public void log(java.lang.String message, int loglevel)
ILogger
log
in interface ILogger
message
- The message that needs to be logged.loglevel
- The log level of the message.ILogger.log(String, int)
public void log(java.lang.String message, java.lang.Throwable throwable, int loglevel)
ILogger
log
in interface ILogger
message
- The message that needs to be logged.throwable
- The stacktrace associated with the message.loglevel
- The log level of the message.ILogger.log(String, Throwable, int)
public static java.lang.String getFormattedDateTime()
public static java.lang.String getLogLevelString(int logLevel)
logLevel
- The log level we want the string representation of.
|
The Meta-Environment API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |