Class LogCaptor

    • Method Detail

      • forRoot

        public static LogCaptor forRoot()
        Captures all log messages
        Returns:
        LogCaptor instance for the root logger
      • forClass

        public static LogCaptor forClass​(Class<?> clazz)
        Captures log messages for the provided class
        Parameters:
        clazz - Class for capturing
        Returns:
        LogCaptor instance for the provided class
      • forName

        public static LogCaptor forName​(String name)
        Captures log messages for the provided logger name
        Parameters:
        name - Logger name for capturing
        Returns:
        LogCaptor instance for the provided logger name
      • getDebugLogs

        public List<String> getDebugLogs()
      • getErrorLogs

        public List<String> getErrorLogs()
      • getTraceLogs

        public List<String> getTraceLogs()
      • hasMessage

        public boolean hasMessage​(String message)
      • hasInfoMessage

        public boolean hasInfoMessage​(String message)
      • hasDebugMessage

        public boolean hasDebugMessage​(String message)
      • hasWarnMessage

        public boolean hasWarnMessage​(String message)
      • hasErrorMessage

        public boolean hasErrorMessage​(String message)
      • hasTraceMessage

        public boolean hasTraceMessage​(String message)
      • addFilter

        public void addFilter​(ch.qos.logback.core.filter.Filter<ch.qos.logback.classic.spi.ILoggingEvent> filter)
      • setLogLevelToInfo

        public void setLogLevelToInfo()
        Overrides the log level property of the target logger. This may result that the overridden property of the target logger is still active even though a new instance of LogCaptor has been created. To roll-back to the initial state use: resetLogLevel() This option will implicitly include the following log levels: WARN and ERROR
      • setLogLevelToDebug

        public void setLogLevelToDebug()
        Overrides the log level property of the target logger. This may result that the overridden property of the target logger is still active even though a new instance of 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 ERROR
      • setLogLevelToTrace

        public void setLogLevelToTrace()
        Overrides the log level property of the target logger. This may result that the overridden property of the target logger is still active even though a new instance of 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 ERROR
      • disableLogs

        public void disableLogs()
        Overrides the log level property of the target logger. This may result that the overridden property of the target logger is still active even though a new instance of LogCaptor has been created. To roll-back to the initial state use: resetLogLevel()
      • disableConsoleOutput

        public void disableConsoleOutput()
        Disables the output of the log entries to the console. To revert this option use enableConsoleOutput(). LogCaptor will still be capturing the log entries.
      • enableConsoleOutput

        public void enableConsoleOutput()
        The output of the log entries to the console are enabled by default but can be re-enabled if they are disabled earlier by disableConsoleOutput()
      • clearLogs

        public void clearLogs()