|
|||||||||
| Home >> All >> com >> synchrona >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.synchrona.util
Class Log

java.lang.Objectcom.synchrona.util.Log
- public class Log
- extends java.lang.Object
Offers the usual logging capabilities. Can also cache a single instance so it can be shared within a JVM. This is useful when logging output should be directed to a single location.
| Field Summary | |
private boolean |
_debug
|
private boolean |
_error
|
private java.text.SimpleDateFormat |
_format
|
private java.io.PrintWriter |
_out
|
private boolean |
_warn
|
static java.lang.String |
DEFAULT_TIMESTAMP_FORMAT
|
static java.lang.String |
LOG_DEBUG_PROPERTY
Name of the property from whose value Log instances determine whether or not debug messages should be printed. |
static java.lang.String |
LOG_ERROR_PROPERTY
Name of the property from whose value Log instances determine whether or not error messages should be printed. |
static java.lang.String |
LOG_WARN_PROPERTY
Name of the property from whose value Log instances determine whether or not warning messages should be printed. |
| Constructor Summary | |
Log(java.io.PrintWriter out)
Create a Log instance. |
|
| Method Summary | |
void |
debug(java.lang.String strCategory,
java.lang.String strMessage)
Print debugging messages, if debugging is enabled. |
void |
debugBytes(java.lang.String strCategory,
java.lang.String strMessage,
byte[] ayBytes,
int nOffset,
int nLength)
|
boolean |
debugEnabled()
Returns true if debugging messages are enabled. |
void |
error(java.lang.String strCategory,
java.lang.String strMessage)
Print error messages, if errors is enabled. |
void |
errorBytes(java.lang.String strCategory,
java.lang.String strMessage,
byte[] ayBytes,
int nOffset,
int nLength)
|
boolean |
errorsEnabled()
|
private boolean |
initState(java.lang.String strLevel,
boolean bDefault)
Looks for a property that defines the initial state (enabled/ disabled) of a log level. |
private boolean |
isEnabled(java.lang.String type,
boolean typeDefault,
java.lang.String category)
Returns true if logging is enabled for this combination of type and category. |
private void |
log(boolean bFlag,
java.lang.String strType,
java.lang.String strCategory,
java.lang.String strMessage)
If bFlag is true, this method formats its arguments and prints them to the log stream. |
private void |
logBytes(boolean bFlag,
java.lang.String strType,
java.lang.String strCategory,
java.lang.String strMessage,
byte[] ayBytes,
int nOffset,
int nLength)
If bFlag is true, this method formats its arguments and prints them to the log stream. |
void |
warn(java.lang.String strCategory,
java.lang.String strMessage)
|
void |
warnBytes(java.lang.String strCategory,
java.lang.String strMessage,
byte[] ayBytes,
int nOffset,
int nLength)
|
boolean |
warningsEnabled()
Returns true if warning messages are enabled. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
DEFAULT_TIMESTAMP_FORMAT
public static final java.lang.String DEFAULT_TIMESTAMP_FORMAT
- See Also:
- Constant Field Values
LOG_DEBUG_PROPERTY
public static final java.lang.String LOG_DEBUG_PROPERTY
- Name of the property from whose value Log instances determine
whether or not debug messages should be printed. Debug messages
are disabled by default.
- See Also:
- Constant Field Values
LOG_ERROR_PROPERTY
public static final java.lang.String LOG_ERROR_PROPERTY
- Name of the property from whose value Log instances determine
whether or not error messages should be printed. Error messages
are enabled by default.
- See Also:
- Constant Field Values
LOG_WARN_PROPERTY
public static final java.lang.String LOG_WARN_PROPERTY
- Name of the property from whose value Log instances determine
whether or not warning messages should be printed. Warnings are
enabled by default.
- See Also:
- Constant Field Values
_debug
private boolean _debug
_error
private boolean _error
_warn
private boolean _warn
_format
private java.text.SimpleDateFormat _format
_out
private java.io.PrintWriter _out
| Constructor Detail |
Log
public Log(java.io.PrintWriter out)
- Create a Log instance. All messages will be written to the
given PrintWriter.
| Method Detail |
debug
public final void debug(java.lang.String strCategory, java.lang.String strMessage)
- Print debugging messages, if debugging is enabled.
debugBytes
public final void debugBytes(java.lang.String strCategory, java.lang.String strMessage, byte[] ayBytes, int nOffset, int nLength)
debugEnabled
public boolean debugEnabled()
- Returns true if debugging messages are enabled.
error
public final void error(java.lang.String strCategory, java.lang.String strMessage)
- Print error messages, if errors is enabled. Errors are enabled by default.
errorBytes
public final void errorBytes(java.lang.String strCategory, java.lang.String strMessage, byte[] ayBytes, int nOffset, int nLength)
errorsEnabled
public boolean errorsEnabled()
warn
public final void warn(java.lang.String strCategory, java.lang.String strMessage)
warnBytes
public final void warnBytes(java.lang.String strCategory, java.lang.String strMessage, byte[] ayBytes, int nOffset, int nLength)
warningsEnabled
public final boolean warningsEnabled()
- Returns true if warning messages are enabled.
isEnabled
private final boolean isEnabled(java.lang.String type, boolean typeDefault, java.lang.String category)
- Returns true if logging is enabled for this combination
of type and category.
initState
private final boolean initState(java.lang.String strLevel, boolean bDefault)
- Looks for a property that defines the initial state (enabled/
disabled) of a log level. If the property is not defined,
initState() returns the given default value.
log
private void log(boolean bFlag,
java.lang.String strType,
java.lang.String strCategory,
java.lang.String strMessage)
- If bFlag is true, this method formats its arguments and
prints them to the log stream. This method is used by
debug(), error(),
and warn().
logBytes
private void logBytes(boolean bFlag,
java.lang.String strType,
java.lang.String strCategory,
java.lang.String strMessage,
byte[] ayBytes,
int nOffset,
int nLength)
- If bFlag is true, this method formats its arguments and
prints them to the log stream. This method is used by
debug(), error(),
and warn().
|
|||||||||
| Home >> All >> com >> synchrona >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.synchrona.util.Log