public class MockLogger
extends org.slf4j.helpers.MarkerIgnoringBase
Simple implementation of Logger
based on SimpleLogger from SLF4J
This implementation is heavily inspired by Apache Commons Logging's SimpleLog.
Modifier and Type | Field and Description |
---|---|
protected Level |
currentLogLevel
The current log level
|
static String |
DATE_TIME_FORMAT_KEY |
static String |
DEFAULT_LOG_LEVEL_KEY |
static String |
LEVEL_IN_BRACKETS_KEY |
static String |
LOG_FILE_KEY |
static String |
LOG_KEY_PREFIX |
protected String |
name |
static String |
SHOW_DATE_TIME_KEY |
static String |
SHOW_LOG_NAME_KEY |
static String |
SHOW_SHORT_LOG_NAME_KEY |
static String |
SHOW_THREAD_NAME_KEY |
static String |
SYSTEM_PREFIX
All system properties used by
MockLogger start with this prefix |
static String |
WARN_LEVEL_STRING_KEY |
Modifier and Type | Method and Description |
---|---|
void |
debug(String msg)
A simple implementation which logs messages of level DEBUG according
to the format outlined above.
|
void |
debug(String format,
Object... argArray)
Perform double parameter substitution before logging the message of level
DEBUG according to the format outlined above.
|
void |
debug(String format,
Object param1)
Perform single parameter substitution before logging the message of level
DEBUG according to the format outlined above.
|
void |
debug(String format,
Object param1,
Object param2)
Perform double parameter substitution before logging the message of level
DEBUG according to the format outlined above.
|
void |
debug(String msg,
Throwable t)
Log a message of level DEBUG, including an exception.
|
void |
error(String msg)
A simple implementation which always logs messages of level ERROR according
to the format outlined above.
|
void |
error(String format,
Object... argArray)
Perform double parameter substitution before logging the message of level
ERROR according to the format outlined above.
|
void |
error(String format,
Object arg)
Perform single parameter substitution before logging the message of level
ERROR according to the format outlined above.
|
void |
error(String format,
Object arg1,
Object arg2)
Perform double parameter substitution before logging the message of level
ERROR according to the format outlined above.
|
void |
error(String msg,
Throwable t)
Log a message of level ERROR, including an exception.
|
void |
info(String msg)
A simple implementation which logs messages of level INFO according
to the format outlined above.
|
void |
info(String format,
Object... argArray)
Perform double parameter substitution before logging the message of level
INFO according to the format outlined above.
|
void |
info(String format,
Object arg)
Perform single parameter substitution before logging the message of level
INFO according to the format outlined above.
|
void |
info(String format,
Object arg1,
Object arg2)
Perform double parameter substitution before logging the message of level
INFO according to the format outlined above.
|
void |
info(String msg,
Throwable t)
Log a message of level INFO, including an exception.
|
boolean |
isDebugEnabled()
Are
debug messages currently enabled? |
boolean |
isErrorEnabled()
Are
error messages currently enabled? |
boolean |
isInfoEnabled()
Are
info messages currently enabled? |
protected boolean |
isLevelEnabled(Level logLevel)
Is the given log level currently enabled?
|
boolean |
isTraceEnabled()
Are
trace messages currently enabled? |
boolean |
isWarnEnabled()
Are
warn messages currently enabled? |
protected Object |
readResolve() |
void |
trace(String msg)
A simple implementation which logs messages of level TRACE according
to the format outlined above.
|
void |
trace(String format,
Object... argArray)
Perform double parameter substitution before logging the message of level
TRACE according to the format outlined above.
|
void |
trace(String format,
Object param1)
Perform single parameter substitution before logging the message of level
TRACE according to the format outlined above.
|
void |
trace(String format,
Object param1,
Object param2)
Perform double parameter substitution before logging the message of level
TRACE according to the format outlined above.
|
void |
trace(String msg,
Throwable t)
Log a message of level TRACE, including an exception.
|
void |
warn(String msg)
A simple implementation which always logs messages of level WARN according
to the format outlined above.
|
void |
warn(String format,
Object... argArray)
Perform double parameter substitution before logging the message of level
WARN according to the format outlined above.
|
void |
warn(String format,
Object arg)
Perform single parameter substitution before logging the message of level
WARN according to the format outlined above.
|
void |
warn(String format,
Object arg1,
Object arg2)
Perform double parameter substitution before logging the message of level
WARN according to the format outlined above.
|
void |
warn(String msg,
Throwable t)
Log a message of level WARN, including an exception.
|
debug, debug, debug, debug, debug, error, error, error, error, error, info, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isTraceEnabled, isWarnEnabled, toString, trace, trace, trace, trace, trace, warn, warn, warn, warn, warn
public static final String SYSTEM_PREFIX
MockLogger
start with this prefixpublic static final String DEFAULT_LOG_LEVEL_KEY
public static final String SHOW_DATE_TIME_KEY
public static final String DATE_TIME_FORMAT_KEY
public static final String SHOW_THREAD_NAME_KEY
public static final String SHOW_LOG_NAME_KEY
public static final String SHOW_SHORT_LOG_NAME_KEY
public static final String LOG_FILE_KEY
public static final String LEVEL_IN_BRACKETS_KEY
public static final String WARN_LEVEL_STRING_KEY
public static final String LOG_KEY_PREFIX
protected Level currentLogLevel
protected String name
protected boolean isLevelEnabled(Level logLevel)
logLevel
- is this level enabled?public boolean isTraceEnabled()
trace
messages currently enabled?public void trace(String msg)
public void trace(String format, Object param1)
public void trace(String format, Object param1, Object param2)
public void trace(String format, Object... argArray)
public void trace(String msg, Throwable t)
public boolean isDebugEnabled()
debug
messages currently enabled?public void debug(String msg)
public void debug(String format, Object param1)
public void debug(String format, Object param1, Object param2)
public void debug(String format, Object... argArray)
public void debug(String msg, Throwable t)
public boolean isInfoEnabled()
info
messages currently enabled?public void info(String msg)
public void info(String format, Object arg)
public void info(String format, Object arg1, Object arg2)
public void info(String format, Object... argArray)
public boolean isWarnEnabled()
warn
messages currently enabled?public void warn(String msg)
public void warn(String format, Object arg)
public void warn(String format, Object arg1, Object arg2)
public void warn(String format, Object... argArray)
public boolean isErrorEnabled()
error
messages currently enabled?public void error(String msg)
public void error(String format, Object arg)
public void error(String format, Object arg1, Object arg2)
public void error(String format, Object... argArray)
public void error(String msg, Throwable t)
protected Object readResolve() throws ObjectStreamException
ObjectStreamException
Copyright © 2021. All rights reserved.