public final class LogCaptor extends Object implements AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
void |
addFilter(ch.qos.logback.core.filter.Filter<ch.qos.logback.classic.spi.ILoggingEvent> filter) |
void |
clearLogs() |
void |
close() |
void |
disableLogs()
Overrides the log level property of the target logger.
|
static <T> LogCaptor |
forClass(Class<T> clazz)
Captures log messages for the provided class
|
static LogCaptor |
forName(String name)
Captures log messages for the provided logger name
|
static LogCaptor |
forRoot()
Captures all log messages
|
List<String> |
getDebugLogs() |
List<String> |
getErrorLogs() |
List<String> |
getInfoLogs() |
List<LogEvent> |
getLogEvents() |
List<String> |
getLogs() |
List<String> |
getTraceLogs() |
List<String> |
getWarnLogs() |
void |
resetLogLevel()
Resets the log level of the target logger to the initial value which was available before
changing it with
setLogLevelToInfo(), setLogLevelToDebug() or with setLogLevelToTrace() |
void |
setLogLevelToDebug()
Overrides the log level property of the target logger.
|
void |
setLogLevelToInfo()
Overrides the log level property of the target logger.
|
void |
setLogLevelToTrace()
Overrides the log level property of the target logger.
|
public static LogCaptor forRoot()
public static <T> LogCaptor forClass(Class<T> clazz)
public static LogCaptor forName(String name)
public void addFilter(ch.qos.logback.core.filter.Filter<ch.qos.logback.classic.spi.ILoggingEvent> filter)
public void setLogLevelToInfo()
LogCaptor has been created.
To roll-back to the initial state use: resetLogLevel()
This option will implicitly include the following log levels: WARN and ERRORpublic void setLogLevelToDebug()
LogCaptor has been created.
To roll-back to the initial state use: resetLogLevel()
This option will implicitly include the following log levels: INFO, WARN and ERRORpublic void setLogLevelToTrace()
LogCaptor has been created.
To roll-back to the initial state use: resetLogLevel()
This option will implicitly include the following log levels: INFO, DEBUG, WARN and ERRORpublic void disableLogs()
LogCaptor has been created.
To roll-back to the initial state use: resetLogLevel()public void resetLogLevel()
setLogLevelToInfo(), setLogLevelToDebug() or with setLogLevelToTrace()public void clearLogs()
public void close()
close in interface AutoCloseableCopyright © 2021. All rights reserved.