|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--com.wutka.util.Log
A general mechanism for logging error messages. The Log class supports different clients so messages can be logged in different ways. A log entry has a severity associated with it. Log clients register to receive log messages with a minimum severity value. If there are no clients logging at the entry's severity, no further processing takes place. Thus, the overhead for debug messages is not very heavy.
| Field Summary | |
static java.lang.String |
ALL
For log clients, grab messages for all subsystems |
protected static java.util.Hashtable |
clients
The clients currently registered with the logger |
static java.lang.String |
DEFAULT
For a log entry, a default location for log messages not associated with a particular subsystem. |
protected static java.lang.String |
hexDigits
|
protected static java.util.Hashtable |
minLevels
The minimum levels being logged for each subsystem |
| Constructor Summary | |
Log()
|
|
| Method Summary | |
static void |
addClient(java.lang.String subsystem,
LogSeverity minSeverity,
LogClient theClient)
Add a new client for a particular subsystem and severity level |
static void |
logBytes(LogSeverity severity,
java.lang.String message,
byte[] data)
Logs a text message and a hex dump of data to the default subsystem |
static void |
logBytes(LogSeverity severity,
java.lang.String message,
byte[] data,
int offset,
int length)
Logs a text message and a hex dump of data to the default subsystem |
static void |
logBytes(LogSeverity severity,
java.lang.String subsystem,
java.lang.String message,
byte[] data)
Logs a text message and a hex dump of data for a particular subsystem |
static void |
logBytes(LogSeverity severity,
java.lang.String subsystem,
java.lang.String message,
byte[] data,
int offset,
int length)
Logs a text message and a hex dump of data for a particular subsystem |
static void |
logException(LogSeverity severity,
java.lang.String message,
java.lang.Exception exc)
Logs a text message and an exception to the default subsystem |
static void |
logException(LogSeverity severity,
java.lang.String subsystem,
java.lang.String message,
java.lang.Exception exc)
Logs a text message for a particular subsystem |
static void |
logMessage(LogSeverity severity,
java.lang.String message)
Logs a text message to the default subsystem |
static void |
logMessage(LogSeverity severity,
java.lang.String subsystem,
java.lang.String message)
Logs a text message for a particular subsystem |
static java.lang.String |
makeHexDump(byte[] data,
int offset,
int length)
Creates a string containing a hex dump of the data bytes |
protected static void |
recomputeMinLevel(java.lang.String subsystem)
Recalculate the minimum logging level for a subsystem (and for all) |
static void |
removeClient(LogClient theClient)
Removes a client from all subsystems it is logging |
static void |
removeClient(java.lang.String subsystem,
LogClient theClient)
Removes a client that is logging messages for the named subsystems |
static boolean |
wouldLog(java.lang.String subsystem,
LogSeverity severity)
Returns true if a message for this subsystem and severity would be logged. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String DEFAULT
public static final java.lang.String ALL
protected static java.util.Hashtable clients
protected static java.util.Hashtable minLevels
protected static java.lang.String hexDigits
| Constructor Detail |
public Log()
| Method Detail |
public static void addClient(java.lang.String subsystem,
LogSeverity minSeverity,
LogClient theClient)
subsystem - The subsystem the client wants to receive messages for (Log.ALL for all subsystemsminSeverity - The minimum threshold for messages to be sent to this clienttheClient - The client that will receive the messagesprotected static void recomputeMinLevel(java.lang.String subsystem)
subsystem - The subsystem the level is being computed for
public static void removeClient(java.lang.String subsystem,
LogClient theClient)
subsystem - The subsystem the client is being removed fromtheClient - The client being removedpublic static void removeClient(LogClient theClient)
theClient - being removed
public static boolean wouldLog(java.lang.String subsystem,
LogSeverity severity)
subsystem - The subsystem the message would be logged forseverity - The severity level to test
public static void logMessage(LogSeverity severity,
java.lang.String message)
severity - The severity level of the messagemessage - The message to be logged
public static void logMessage(LogSeverity severity,
java.lang.String subsystem,
java.lang.String message)
severity - The severity level of the messagesubsystem - The subsystem being loggedmessage - The message to be logged
public static void logException(LogSeverity severity,
java.lang.String message,
java.lang.Exception exc)
severity - The severity level of the messagemessage - The message to be loggedexc - The exception to be logged
public static void logException(LogSeverity severity,
java.lang.String subsystem,
java.lang.String message,
java.lang.Exception exc)
severity - The severity level of the messagesubsystem - The subsystem being loggedmessage - The message to be loggedexc - The exception to be logged
public static void logBytes(LogSeverity severity,
java.lang.String message,
byte[] data)
severity - The severity level of the messagemessage - The message to be loggeddata - The data to be logged
public static void logBytes(LogSeverity severity,
java.lang.String subsystem,
java.lang.String message,
byte[] data)
severity - The severity level of the messagesubsystem - The subsystem being loggedmessage - The message to be loggeddata - The data to be logged
public static void logBytes(LogSeverity severity,
java.lang.String message,
byte[] data,
int offset,
int length)
severity - The severity level of the messagemessage - The message to be loggeddata - The data to be loggedoffset - The first byte in the data to be loggedlength - The number of bytes to be logged
public static void logBytes(LogSeverity severity,
java.lang.String subsystem,
java.lang.String message,
byte[] data,
int offset,
int length)
severity - The severity level of the messagesubsystem - The subsystem being loggedmessage - The message to be loggeddata - The data to be loggedoffset - The first byte in the data to be loggedlength - The number of bytes to be logged
public static java.lang.String makeHexDump(byte[] data,
int offset,
int length)
data - The bytes to be convertedoffset - The offset of the first byte to be convertedlength - The number of bytes to be converted
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||