public class MClog
extends java.lang.Object
In normal operation, the log lines are written to a log file configured in the merge.ini file. It is also possible to register a custom log handler that will be called whenever a log line is generated.
The toolkit generates log messages of different types, each type is represented by an instance of the
MClog.MClogLevel
class. The following is a summary of the types:
Modifier and Type | Class and Description |
---|---|
static class |
MClog.MClogLevel
Class representing a log level (type).
|
static class |
MClog.MClogStatus
Class representing a log status code.
|
Modifier and Type | Field and Description |
---|---|
static int |
Bitbucket_Destination
Bitmask used to set the log destination to nothing.
|
static int |
File_Destination
Bitmask used to set the log destination to file.
|
static int |
Memory_Destination
Bitmask used to set the log destination to memory (custom log handlers).
|
static int |
Screen_Destination
Bitmask used to set the log destination to the screen.
|
Modifier and Type | Method and Description |
---|---|
static void |
addHandler(MClogHandler handler)
Registers a custom log handler with the toolkit.
|
static MClog.MClogStatus |
error(java.lang.String msg)
Logs an error message using the toolkit's logger.
|
static MClogHandler[] |
getHandlers()
Gets the list of custom log handlers registered with the toolkit.
|
static int |
getLogDestination(MClog.MClogLevel level)
Get the toolkit's log destination.
|
static java.lang.String |
getLogPrefix()
Gets the string that is currently being used as a prefix for all log messages.
|
static MClog.MClogStatus |
info(java.lang.String msg)
Logs an info message using the toolkit's logger.
|
static MClog.MClogStatus |
log(MClog.MClogLevel level,
java.lang.String msg)
Logs a message using the toolkit's logger.
|
static void |
removeHandler(MClogHandler handler)
Unregisters a custom log handler.
|
static void |
setLogDestination(MClog.MClogLevel level,
int destinations)
Set the toolkit's log destination.
|
static java.lang.String |
setLogPrefix(java.lang.String prefix)
Sets a string that will prefix each log message line.
|
static MClog.MClogStatus |
t2(java.lang.String msg)
Logs a T2 message using the toolkit's logger.
|
static MClog.MClogStatus |
t3(java.lang.String msg)
Logs a T3 message using the toolkit's logger.
|
static MClog.MClogStatus |
t4(java.lang.String msg)
Logs a T4 message using the toolkit's logger.
|
static MClog.MClogStatus |
t5(java.lang.String msg)
Logs a T5 message using the toolkit's logger.
|
static MClog.MClogStatus |
t6(java.lang.String msg)
Logs a T6 message using the toolkit's logger.
|
static MClog.MClogStatus |
t7(java.lang.String msg)
Logs a T7 message using the toolkit's logger.
|
static MClog.MClogStatus |
t8(java.lang.String msg)
Logs a T8 message using the toolkit's logger.
|
static MClog.MClogStatus |
t9(java.lang.String msg)
Logs a T9 message using the toolkit's logger.
|
static MClog.MClogStatus |
warning(java.lang.String msg)
Logs a warning message using the toolkit's logger.
|
public static final int File_Destination
public static final int Memory_Destination
public static final int Screen_Destination
public static final int Bitbucket_Destination
public static MClogHandler[] getHandlers()
public static void addHandler(MClogHandler handler)
This method adds the specified handler to the list of handlers that are already registered with the toolkit.
Every log message will be given to all registered handlers in the order the handlers were registered.
handler
- An MClogHandler
implementation.MCexception
- If the handler is null
.public static MClog.MClogStatus t2(java.lang.String msg)
msg
- The message to be logged.MClog.MClogStatus
object representing the status of the logging operation.public static MClog.MClogStatus t3(java.lang.String msg)
msg
- The message to be logged.MClog.MClogStatus
object representing the status of the logging operation.public static MClog.MClogStatus t4(java.lang.String msg)
msg
- The message to be logged.MClog.MClogStatus
object representing the status of the logging operation.public static MClog.MClogStatus t5(java.lang.String msg)
msg
- The message to be logged.MClog.MClogStatus
object representing the status of the logging operation.public static MClog.MClogStatus t6(java.lang.String msg)
msg
- The message to be logged.MClog.MClogStatus
object representing the status of the logging operation.public static MClog.MClogStatus t7(java.lang.String msg)
msg
- The message to be logged.MClog.MClogStatus
object representing the status of the logging operation.public static MClog.MClogStatus t8(java.lang.String msg)
msg
- The message to be logged.MClog.MClogStatus
object representing the status of the logging operation.public static MClog.MClogStatus t9(java.lang.String msg)
msg
- The message to be logged.MClog.MClogStatus
object representing the status of the logging operation.public static MClog.MClogStatus info(java.lang.String msg)
msg
- The message to be logged.MClog.MClogStatus
object representing the status of the logging operation.public static MClog.MClogStatus log(MClog.MClogLevel level, java.lang.String msg)
If the logger is currently enabled for the given log level then the message is forwarded to all the registered log handler objects.
level
- The log level of the message.msg
- The message to be logged.MClog.MClogStatus
object representing the status of the logging operation.public static void removeHandler(MClogHandler handler)
handler
- The log handler to unregister.MCexception
- If the handler is null
.public static MClog.MClogStatus error(java.lang.String msg)
msg
- The message to be logged.MClog.MClogStatus
object representing the status of the logging operation.public static MClog.MClogStatus warning(java.lang.String msg)
msg
- The message to be logged.MClog.MClogStatus
object representing the status of the logging operation.public static int getLogDestination(MClog.MClogLevel level)
level
- The log level for which to get the destination.File_Destination
,
Screen_Destination
, Memory_Destination
and Bitbucket_Destination
fields.public static void setLogDestination(MClog.MClogLevel level, int destinations)
level
- The log level for which to set the destination.destinations
- The destination as specified by the File_Destination
,
Screen_Destination
, Memory_Destination
and Bitbucket_Destination
fields.public static java.lang.String setLogPrefix(java.lang.String prefix)
The first 10 characters of the string provided will be used for the new log prefix. If prefix is null or an empty string, the new log prefix will be an empty string.
prefix
- - The string to use for log message prefix.public static java.lang.String getLogPrefix()