|
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 | ||||||||
public interface Log
A very simple logger used in this project.
Logs are either associated with a specific class, or a default global log.
Logs are created by a LogFactory object.
| Method Summary | |
|---|---|
Log |
error(Object... messages)
Logs each part of an error message supplied in messages
with this log as is, no trailing new line or white space
inserted between message parts, but with a single new line
character after the last part as well as a prefix
indicating the message represent an error message. |
int |
getLineNumber()
If this log logs line numbers, the current line number is returned; otherwise 0. |
String |
getPrefix()
Returns the prefix of this log that will be prefixed to all log messages starting at a new line. |
Log |
heading(Object... messages)
Logs each part of a heading supplied in messages
with this log as is, no trailing new line or white space
inserted between heading parts, but with a single new line
character after the last part, underscored on the next log
line. |
boolean |
isActive()
Returns true if this log is active, i.e. logs messages, false if inactive. |
Log |
print(boolean condition,
Object... messages)
Logs each message part supplied in messages
with this log as is, no trailing new line or
white space inserted between messages, if and only
if condition is true. |
Log |
print(Object... messages)
Logs each message part supplied in messages
with this log as is, no trailing new line or
white space inserted between messages. |
Log |
println(boolean condition,
Object... messages)
Logs each message part supplied in messages
with this log as is, no trailing new line or
white space inserted between messages, if and only
if condition is true, but always with a
single new line character after the last part. |
Log |
println(Object... messages)
Logs each message part supplied in messages
with this log as is, no trailing new line or
white space inserted between messages, but with a
single new line character after the last part. |
Log |
setActive(boolean active)
If active is true, this log is set to active, i.e. to
log messages. |
Log |
warn(Object... messages)
Logs each part of a warning message supplied in messages
with this log as is, no trailing new line or white space
inserted between message parts, but with a single new line
character after the last part as well as a prefix
indicating the message represent a warning message. |
| Method Detail |
|---|
Log error(Object... messages)
messages
with this log as is, no trailing new line or white space
inserted between message parts, but with a single new line
character after the last part as well as a prefix
indicating the message represent an error message.
A part that is null is logged as the string null.
Example (default log):
error("This", "is ", " an ", "error"):
MAIN:xxx:123:: > ERROR - Thisis an error(newline)
Where xxx is the name of the member invoking the
error method and 123 the line number.
messages - The message parts; can be null, corresponding to
a single new line being printed.
int getLineNumber()
String getPrefix()
Log heading(Object... messages)
messages
with this log as is, no trailing new line or white space
inserted between heading parts, but with a single new line
character after the last part, underscored on the next log
line.
A message that is null is logged as the string null.
Example (default log):
heading("This", "is ", " a ", "heading"):
(newline)
MAIN:xxx:123:: Thisis a heading(newline)
MAIN:xxx:123:: =================(newline)
(newline)
(newline)
Where xxx is the name of the member invoking the
heading method and 123 the line number.
messages - The message parts; can be null, corresponding to
a single new line being printed (no underscore).
boolean isActive()
Log print(boolean condition,
Object... messages)
messages
with this log as is, no trailing new line or
white space inserted between messages, if and only
if condition is true.
A part that is null is logged as the string null.
Example (default log):
i = 1; .. print(i > 0, "This", "is ", "message #", new Integer(42), "!"): MAIN:xxx:123:: Thisis message #42! .. i = 0; .. print(i > 0, "This", "is ", "message #", new Integer(42), "!"): (nothing logged)Where
xxx is the name of the member invoking the
print method and 123 the line number.
condition - The condition to use.messages - The message parts; can be null, which will not
print anything.
Log print(Object... messages)
messages
with this log as is, no trailing new line or
white space inserted between messages.
A part that is null is logged as the string null.
Example (default log):
print("This", "is ", "message #", new Integer(42), "!"):
MAIN:xxx:123:: Thisis message #42!
Where xxx is the name of the member invoking the
print method and 123 the line number.
messages - The message parts; can be null, which will not
print anything.
Log println(boolean condition,
Object... messages)
messages
with this log as is, no trailing new line or
white space inserted between messages, if and only
if condition is true, but always with a
single new line character after the last part. Hence,
if condition is false, the effect is
equivalent to println().
A part that is null is logged as the string null.
Example (default log):
i = 1; .. println(i > 0, "This", "is ", "message #", new Integer(42), "!"): MAIN:xxx:123:: Thisis message #42!(newline) .. i = 0; .. println(i > 0, "This", "is ", "message #", new Integer(42), "!"): (newline logged only)Where
xxx is the name of the member invoking the
println method and 123 the line number.
condition - The condition to use.messages - The message parts; can be null, corresponding to
a single new line being printed.
Log println(Object... messages)
messages
with this log as is, no trailing new line or
white space inserted between messages, but with a
single new line character after the last part.
A part that is null is logged as the string null.
Example (default log):
println("This", "is ", "message #", new Integer(42), "!"):
MAIN:xxx:123:: Thisis message #42!(newline)
Where xxx is the name of the member invoking the
println method and 123 the line number.
messages - The message parts; can be null, corresponding to
a single new line being printed.
Log setActive(boolean active)
active is true, this log is set to active, i.e. to
log messages.
active - True to (re-)activate, false to disable.
Log warn(Object... messages)
messages
with this log as is, no trailing new line or white space
inserted between message parts, but with a single new line
character after the last part as well as a prefix
indicating the message represent a warning message.
A part that is null is logged as the string null.
Example (default log):
warn("This", "is ", " a", "warning"):
MAIN:xxx:123:: > WARN - Thisis awarning(newline)
Where xxx is the name of the member invoking the
warn method and 123 the line number.
messages - The message parts; can be null, corresponding to
a single new line being printed.
|
Gunni Rode / rode.dk | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||