Loggingpublic class Logging extends LoggingBase 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. |
Fields Summary |
---|
public static final int | REPORT_LEVELFlag 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]");
}
| public static final boolean | ASSERT_ENABLEDFlag 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");
}
| public static final boolean | TRACE_ENABLEDFlag 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]");
}
}
|
Methods 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.
|
|