|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.rode.thesis.meta.log.AbstractLog dk.rode.thesis.meta.log.AppendableLog
public class AppendableLog
An appendable log uses an Appendable
object as
the target for log messages, for example a PrintStream
such as System.out
.
Field Summary | |
---|---|
private boolean |
close
True if out should be closed when this log goes
out of scope, false if not. |
private Appendable |
out
The target for log messages. |
Constructor Summary | |
---|---|
AppendableLog(Appendable out,
boolean close,
Class<?> clazz,
boolean active,
AtomicInteger lineNumber)
Constructor, which creates this log as active if active
is true. |
|
AppendableLog(Appendable out,
Class<?> clazz)
Constructor, which creates this log as active. |
Method Summary | |
---|---|
protected void |
finalize()
Closes the appendable used by this logger if so specified at construction time and if the appendable is closeable. |
protected void |
log(Object... messages)
Performs the actual logging of the messages supplied as messages with no new line postfixed. |
Methods inherited from class dk.rode.thesis.meta.log.AbstractLog |
---|
error, format, getLineNumber, getPrefix, getPrefix, heading, isActive, print, print, println, println, setActive, toString, warn |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface dk.rode.thesis.meta.log.Log |
---|
error, getLineNumber, getPrefix, heading, isActive, print, print, println, println, setActive, warn |
Field Detail |
---|
private final boolean close
out
should be closed when this log goes
out of scope, false if not.
private final Appendable out
Never null.
Constructor Detail |
---|
AppendableLog(Appendable out, boolean close, Class<?> clazz, boolean active, AtomicInteger lineNumber)
active
is true.
out
is closed by this log if close
is true.
out
- The target for log messages; cannot be null.close
- True to close out
when this log goes
out of scope.clazz
- The class this log is associated with, if any;
can be null.active
- True if this log is initially active, false if not.lineNumber
- Line number values; can be null, in which case
line numbers are not generated.
NullPointerException
- If out
is null.AbstractLog.isActive()
AppendableLog(Appendable out, Class<?> clazz)
out
is not closed by this log.
No line numbers are logged.
out
- The target for log messages; cannot be null.clazz
- The class this log is associated with, if any;
can be null.
NullPointerException
- If out
is null.Method Detail |
---|
protected void finalize()
finalize
in class Object
protected void log(Object... messages) throws IOException
AbstractLog
messages
with no new line postfixed.
All messages part are assumed to have a meaningful
toString()
representation and are not null,
and there is no need for explicit formatting.
log
in class AbstractLog
messages
- The messages to log; never null.
IOException
- In case an exception occurs while logging.
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |