| java.lang.Object com.sun.midp.log.LoggingBase com.sun.midp.log.Logging
Logging | public class Logging extends LoggingBase (Code) | | The purpose of the logging service is to provide a standard means
to report runtime information from within Java or native code.
The porting process is eased by having to modify one logging
service implementation in place of handling the ad hoc use of
println() , printf() , putc() ,
and other functions currently used.
An assert mechanism for Java code, implemented using the logging
service is also provided here for convenience.
This class consists of the Java interface to the functionality
of the logging service.
|
Field Summary | |
final public static boolean | ASSERT_ENABLED Flag allowing client code with assert statements
to be compiled out of a production build. | final public static int | REPORT_LEVEL Flag allowing client code with reporting levels less
than this to be compiled out of the build. | final public static boolean | TRACE_ENABLED Flag to indicate whether tracing is enabled in the
Logging service. |
Method Summary | |
public static void | enableAssert(int enabled) Enables or disables assertions. | public static void | enableTrace(int enabled) Enables or disables tracing. | public static void | initLogSettings(int suiteId) Loads the logging settings for the specified suite. | public static void | setReportLevel(int newReportLevel) Sets a new report level. |
ASSERT_ENABLED | final public static boolean ASSERT_ENABLED(Code) | | Flag allowing client code with assert statements
to be compiled out of a production build. Clients of
the assertion service should wrap calls to the
assert() method to enable them to be
removed from builds when desired
if (Logging.ASSERT_ENABLED) {
Logging.assertTrue([eval to boolean], "message");
}
|
REPORT_LEVEL | final public static int REPORT_LEVEL(Code) | | Flag allowing client code with reporting levels less
than this to be compiled out of the build. Callers
should use this flag as a way to remove bytecodes
related to unneeded levels of reporting from the
resulting classfiles.
For Example:
if (Logging.REPORT_LEVEL <= severity) {
Logging.report(Logging.<severity>,
LogChannels.<channel>,
"[meaningful message]");
}
|
TRACE_ENABLED | final public static boolean TRACE_ENABLED(Code) | | Flag to indicate whether tracing is enabled in the
Logging service. If the flag is false ,
calls to the trace() method will have
no effect. Callers should use this flag as a type of
compile option to remove unnecessary bytecodes from
resulting classfiles.
For example:
} catch (Throwable t) {
if (Logging.TRACE_ENABLED) {
Logging.trace(t, "[meaningful message]");
}
}
|
enableAssert | public static void enableAssert(int enabled)(Code) | | Enables or disables assertions.
Parameters: enabled - > 0 - enable assertions, == 0 - disable it,< 0 - don't change the current setting |
enableTrace | public static void enableTrace(int enabled)(Code) | | Enables or disables tracing.
Parameters: enabled - > 0 - enable tracing, == 0 - disable it,< 0 - don't change the current setting |
initLogSettings | public static void initLogSettings(int suiteId)(Code) | | Loads the logging settings for the specified suite.
Parameters: suiteId - ID of the suite for which the settings must be loaded |
setReportLevel | public static void setReportLevel(int newReportLevel)(Code) | | Sets a new report level.
Parameters: newReportLevel - new report level |
|
|