- java.lang.Object
-
- org.snmp4j.log.ConsoleLogAdapter
-
- All Implemented Interfaces:
LogAdapter
public class ConsoleLogAdapter extends java.lang.Object implements LogAdapter
TheConsoleLogAdapter
provides simple logging to the console.- Since:
- 1.6
- Version:
- 3.0
- Author:
- Frank Fock
-
-
Constructor Summary
Constructors Constructor Description ConsoleLogAdapter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
debug(java.io.Serializable message)
Logs a debug message.void
error(java.io.Serializable message)
Logs an error message.void
error(java.lang.CharSequence message, java.lang.Throwable throwable)
Logs an error message.void
fatal(java.lang.CharSequence message, java.lang.Throwable throwable)
Logs a fatal message.void
fatal(java.lang.Object message)
Logs a fatal message.static java.text.DateFormat
getDateAndTimeFormat()
LogLevel
getEffectiveLogLevel()
Returns the log level that is effective for this log adapter.java.util.Iterator<?>
getLogHandler()
Returns the log handlers associated with this logger.LogLevel
getLogLevel()
Returns the log level defined for this log adapter.java.lang.String
getName()
Returns the name of the logger.void
info(java.lang.CharSequence message)
Logs an informational message.boolean
isDebugEnabled()
Checks whether DEBUG level logging is activated for this log adapter.boolean
isInfoEnabled()
Checks whether INFO level logging is activated for this log adapter.boolean
isWarnEnabled()
Checks whether WARN level logging is activated for this log adapter.static void
setDateAndTimeFormat(java.text.DateFormat dateAndTimeFormat)
static void
setDebugEnabled(boolean isDebugEnabled)
static void
setInfoEnabled(boolean isInfoEnabled)
void
setLogLevel(LogLevel level)
Sets the log level for this log adapter (if applicable).static void
setWarnEnabled(boolean isWarnEnabled)
java.lang.String
toString()
void
warn(java.io.Serializable message)
Logs an warning message.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.snmp4j.log.LogAdapter
isLogLevelEnabled, log, removeAllHandlers, setLogHandler
-
-
-
-
Method Detail
-
debug
public void debug(java.io.Serializable message)
Logs a debug message.- Specified by:
debug
in interfaceLogAdapter
- Parameters:
message
- the message to log.
-
error
public void error(java.io.Serializable message)
Logs an error message.- Specified by:
error
in interfaceLogAdapter
- Parameters:
message
- the message to log.
-
error
public void error(java.lang.CharSequence message, java.lang.Throwable throwable)
Logs an error message.- Specified by:
error
in interfaceLogAdapter
- Parameters:
message
- the message to log.throwable
- the exception that caused to error.
-
fatal
public void fatal(java.lang.Object message)
Logs a fatal message.- Specified by:
fatal
in interfaceLogAdapter
- Parameters:
message
- the message to log.
-
fatal
public void fatal(java.lang.CharSequence message, java.lang.Throwable throwable)
Logs a fatal message.- Specified by:
fatal
in interfaceLogAdapter
- Parameters:
message
- the message to log.throwable
- the exception that caused to error.
-
info
public void info(java.lang.CharSequence message)
Logs an informational message.- Specified by:
info
in interfaceLogAdapter
- Parameters:
message
- the message to log.
-
isDebugEnabled
public boolean isDebugEnabled()
Checks whether DEBUG level logging is activated for this log adapter.- Specified by:
isDebugEnabled
in interfaceLogAdapter
- Returns:
true
if logging is enabled orfalse
otherwise.
-
isInfoEnabled
public boolean isInfoEnabled()
Checks whether INFO level logging is activated for this log adapter.- Specified by:
isInfoEnabled
in interfaceLogAdapter
- Returns:
true
if logging is enabled orfalse
otherwise.
-
isWarnEnabled
public boolean isWarnEnabled()
Checks whether WARN level logging is activated for this log adapter.- Specified by:
isWarnEnabled
in interfaceLogAdapter
- Returns:
true
if logging is enabled orfalse
otherwise.
-
warn
public void warn(java.io.Serializable message)
Logs an warning message.- Specified by:
warn
in interfaceLogAdapter
- Parameters:
message
- the message to log.
-
setDebugEnabled
public static void setDebugEnabled(boolean isDebugEnabled)
-
setWarnEnabled
public static void setWarnEnabled(boolean isWarnEnabled)
-
setInfoEnabled
public static void setInfoEnabled(boolean isInfoEnabled)
-
setLogLevel
public void setLogLevel(LogLevel level)
Description copied from interface:LogAdapter
Sets the log level for this log adapter (if applicable).- Specified by:
setLogLevel
in interfaceLogAdapter
- Parameters:
level
- a LogLevel instance.
-
getName
public java.lang.String getName()
Description copied from interface:LogAdapter
Returns the name of the logger.- Specified by:
getName
in interfaceLogAdapter
- Returns:
- the name of the logger.
-
getLogLevel
public LogLevel getLogLevel()
Description copied from interface:LogAdapter
Returns the log level defined for this log adapter.- Specified by:
getLogLevel
in interfaceLogAdapter
- Returns:
- a LogLevel instance.
-
getEffectiveLogLevel
public LogLevel getEffectiveLogLevel()
Description copied from interface:LogAdapter
Returns the log level that is effective for this log adapter. The effective log level is the first log level different fromLogLevel.NONE
to the root.- Specified by:
getEffectiveLogLevel
in interfaceLogAdapter
- Returns:
- a LogLevel different than
LogLevel.NONE
.
-
getLogHandler
public java.util.Iterator<?> getLogHandler()
Description copied from interface:LogAdapter
Returns the log handlers associated with this logger.- Specified by:
getLogHandler
in interfaceLogAdapter
- Returns:
- an Iterator of log system dependent log handlers.
-
getDateAndTimeFormat
public static java.text.DateFormat getDateAndTimeFormat()
-
setDateAndTimeFormat
public static void setDateAndTimeFormat(java.text.DateFormat dateAndTimeFormat)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-