|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ibm.jusb.util.UsbTracer
public abstract class UsbTracer
Class to provide abstracted tracing for javax.usb implementation(s).
This allows the javax.usb implementations (common implementation and any platform implementations) to perform tracing in a generic manner, whose output can be controlled by the user and redirected to any desired trace package or function.
To use this tracing, either create a UsbTracer object yourself with the
getUsbTracer(name, level) method and use that
object for all your tracing, or use the default/global UsbTracer object via
UsbTracer.getUsbTracer().
Each UsbTracer object has a default name and level. The name should be used by the UsbTracer implementation, possibly be prefixing the trace message with it. The level should be used by the UsbTracer implementation, usually by printing out only messages with a higher priority that the implementation's current priority setting (which is dependent on the implementation).
| Field Summary | |
|---|---|
protected int |
defaultLevel
|
protected String |
defaultName
|
static String |
GLOBAL_TRACER_LEVEL_PROPERTY
|
static String |
GLOBAL_TRACER_NAME_PROPERTY
|
static int |
TRACE_CRITICAL
|
static String |
TRACE_CRITICAL_PROPERTY
|
static int |
TRACE_DEBUG
|
static String |
TRACE_DEBUG_PROPERTY
|
static int |
TRACE_ERROR
|
static String |
TRACE_ERROR_PROPERTY
|
static String |
TRACE_IMPLEMENTATION_PROPERTY
|
static int |
TRACE_INFO
|
static String |
TRACE_INFO_PROPERTY
|
static int |
TRACE_NOTICE
|
static String |
TRACE_NOTICE_PROPERTY
|
static int |
TRACE_WARN
|
static String |
TRACE_WARN_PROPERTY
|
| Constructor Summary | |
|---|---|
protected |
UsbTracer(String name,
int level)
Create a new UsbTracer with the specified name and trace level. |
| Method Summary | |
|---|---|
int |
getDefaultLevel()
Get the default level for this UsbTracer object. |
String |
getDefaultName()
Get the default name for this UsbTracer object. |
protected static int |
getIntTraceLevel(String level)
This translates the provided String trace level to an int level. |
static UsbTracer |
getUsbTracer()
Get the default/global UsbTracer. |
static UsbTracer |
getUsbTracer(String name,
int level)
Get a new UsbTracer object with the specified name and level. |
void |
print(int level,
String msg)
Trace message with this UsbTracer object's default name at the specified level. |
void |
print(String msg)
Trace message with this UsbTracer object's default name and default level. |
abstract void |
print(String name,
int level,
String msg)
Trace message with the specified name at the specified level. |
void |
print(String name,
String msg)
Trace message with the specified name at this UsbTracer object's default level. |
void |
println(int level,
String msg)
Trace message with this UsbTracer object's default name at the specified level. |
void |
println(String msg)
Trace message with this UsbTracer object's default name and default level. |
void |
println(String name,
int level,
String msg)
Trace message with the specified name at the specified level. |
void |
println(String name,
String msg)
Trace message with the specified name at this UsbTracer object's default level. |
void |
setDefaultLevel(int level)
Set the default level for this UsbTracer object. |
void |
setDefaultName(String name)
Set the default name for this UsbTracer object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected String defaultName
protected int defaultLevel
public static final String TRACE_IMPLEMENTATION_PROPERTY
public static final String GLOBAL_TRACER_NAME_PROPERTY
public static final String GLOBAL_TRACER_LEVEL_PROPERTY
public static final String TRACE_CRITICAL_PROPERTY
public static final String TRACE_ERROR_PROPERTY
public static final String TRACE_WARN_PROPERTY
public static final String TRACE_NOTICE_PROPERTY
public static final String TRACE_INFO_PROPERTY
public static final String TRACE_DEBUG_PROPERTY
public static final int TRACE_CRITICAL
public static final int TRACE_ERROR
public static final int TRACE_WARN
public static final int TRACE_NOTICE
public static final int TRACE_INFO
public static final int TRACE_DEBUG
| Constructor Detail |
|---|
protected UsbTracer(String name,
int level)
This creates a new UsbTracer with the specified default values. This is only usable by subclasses, and all subclasses must invoke this constructor.
name - The default name of this tracer object.level - The default trace level of this tracer object.| Method Detail |
|---|
public abstract void print(String name,
int level,
String msg)
name - The name of the trace source.level - The trace level of the message.msg - The trace message.
public void println(String name,
int level,
String msg)
This appends a newline to the message.
name - The name of the trace source.level - The trace level of the message.msg - The trace message.
public void print(String name,
String msg)
name - The name of the trace source.msg - The trace message.
public void println(String name,
String msg)
This appends a newline to the message.
name - The name of the trace source.msg - The trace message.
public void print(int level,
String msg)
level - The trace level of the message.msg - The trace message.
public void println(int level,
String msg)
This appends a newline to the message.
level - The trace level of the message.msg - The trace message.public void print(String msg)
msg - The trace message.public void println(String msg)
This appends a newline to the message.
msg - The trace message.public void setDefaultName(String name)
name - The default name.public String getDefaultName()
public void setDefaultLevel(int level)
level - The default level.public int getDefaultLevel()
public static UsbTracer getUsbTracer(String name,
int level)
name - The default trace name for the new UsbTracer.level - The default trace level for the new UsbTracer.
public static UsbTracer getUsbTracer()
This should be used for easy tracing access. The default/global UsbTracer object is returned. Its name defaults to "Main UsbTracer" and level to TRACE_DEBUG. Both are settable from the javax.usb.properties file.
protected static int getIntTraceLevel(String level)
throws Exception
level - The String trace level.
Exception - If the String level did not match a trace int level.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||