|
The Meta-Environment API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoolbus.logging.FileLogger
public class FileLogger
Logger implementation that writes to a file.
Field Summary | |
---|---|
private static java.lang.String |
endLineCharacter
|
private int |
level
|
private boolean |
timestamp
|
private java.io.PrintWriter |
writer
|
Fields inherited from interface toolbus.logging.ILogger |
---|
ALL, DEBUG, DEBUGSTR, ERROR, ERRORSTR, FATAL, FATALSTR, INFO, INFOSTR, LOG, LOGSTR, OFF, UNKNOWNSTR, WARNING, WARNINGSTR |
Constructor Summary | |
---|---|
FileLogger()
Default constructor. |
|
FileLogger(int level)
Constructor. |
Method Summary | |
---|---|
void |
finalize()
Closes this logger. |
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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String endLineCharacter
private final int level
private final java.io.PrintWriter writer
private boolean timestamp
Constructor Detail |
---|
FileLogger()
FileLogger(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 void finalize()
finalize
in class java.lang.Object
|
The Meta-Environment API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |