public abstract class LogItem
extends java.lang.Object
The type of the log (i.e. tool-specific, plain text, xml etc.) is identified
by the public mode
field. Valid values are the
LOGMODE
constants defined by AbstractLogFacility
.
Attributes common to all log types, such as name, log level, enabled state,
and closed state etc, are encapsulated in this class.
This class declares two abstract methods:
and
logMessage
. They should be implmented by subclasses
for specific log types that know how to provide those functionality. A
concrete log facility could include instances of appropriate subclasses of
close
LogItem
and delegate its logging functions to them.
AbstractLogFacility
Modifier and Type | Field and Description |
---|---|
protected boolean |
closed |
boolean |
enabled
The enabled state of this log.
|
int |
level
The log level of this log item (one of the
LOGLEVEL
constants defined by AbstractLogFacility ). |
long |
mode
The type of this log item (one of the
LOGMODE constants
defined by AbstractLogFacility ). |
java.lang.String |
name
The name of this log item.
|
Constructor and Description |
---|
LogItem(java.lang.String name,
long mode)
Creates a disabled log and sets its log level to
LOGLEVEL_INFO . |
LogItem(java.lang.String name,
long mode,
boolean enabled)
Creates a log and sets its log level to
LOGLEVEL_INFO . |
LogItem(java.lang.String name,
long mode,
int level,
boolean enabled)
Creates a
LogItem . |
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Closes this log.
|
static java.lang.String |
dateTime(int dateOrTime)
Returns the string representation of the current date or time.
|
boolean |
isClosed()
Tests if this log is closed.
|
abstract void |
logMessage(java.lang.String msg,
java.lang.String desc,
int msgType)
Logs a message to this log.
|
public java.lang.String name
public long mode
LOGMODE
constants
defined by AbstractLogFacility
).public int level
LOGLEVEL
constants defined by AbstractLogFacility
).public boolean enabled
protected boolean closed
public LogItem(java.lang.String name, long mode, int level, boolean enabled)
LogItem
.
name
- the name of this log.mode
- the type of this log (LOGMODE
constant
defined by AbstractLogFacility
).level
- the log level for this log.enabled
- true
to enable this log; false
to disable.public LogItem(java.lang.String name, long mode, boolean enabled)
LOGLEVEL_INFO
.
name
- the name of this log.mode
- the type of this log (LOGMODE
constant
defined by AbstractLogFacility
).enabled
- true
to enable this log; false
to disable.public LogItem(java.lang.String name, long mode)
LOGLEVEL_INFO
.
name
- the name of this log.mode
- the type of this log (LOGMODE
constant
defined by AbstractLogFacility
).public boolean isClosed()
true
if this log is closed; false
if it is open.public static java.lang.String dateTime(int dateOrTime)
dateOrTime
- 0 to return date; 1 to return timepublic abstract void logMessage(java.lang.String msg, java.lang.String desc, int msgType)
msg
- the message to log.desc
- additional description to log.msgType
- the int identifier of the type of message being logged.public abstract void close() throws LogException
LogException
- if this log failed to close for any reason.Copyright © SAS Institute. All Rights Reserved.