Class FilteredLog


  • public class FilteredLog
    extends Object
    Filters the log of a Report instance so that only a limited number of errors will be reported. If the number of errors exceeds this limit, then subsequent error messages will be skipped.
    Author:
    Ullrich Hafner
    • Constructor Detail

      • FilteredLog

        public FilteredLog​(Report report,
                           String title)
        Creates a new FilteredLog for a Report. Number of printed errors: DEFAULT_MAX_LINES.
        Parameters:
        report - the report to filter the error log
        title - the title of the error messages
      • FilteredLog

        public FilteredLog​(Report report,
                           String title,
                           int maxLines)
        Creates a new FilteredLog for a Report.
        Parameters:
        report - the report to filter the error log
        title - the title of the error messages
        maxLines - the maximum number of lines to log
    • Method Detail

      • logInfo

        @FormatMethod
        public void logInfo​(String format,
                            Object... args)
        Logs the specified information message. Use this method to log any useful information when composing this log.
        Parameters:
        format - A format string
        args - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero.
      • logError

        @FormatMethod
        public void logError​(String format,
                             Object... args)
        Logs the specified error message. Use this method to log any error when composing this log.
        Parameters:
        format - A format string
        args - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero.
      • logException

        @FormatMethod
        public void logException​(Exception exception,
                                 String format,
                                 Object... args)
        Logs the specified exception. Use this method to log any exception when composing this log.
        Parameters:
        exception - the exception to log
        format - A format string
        args - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero.
      • size

        public int size()
        Returns the total number of errors that have been reported.
        Returns:
        the total number of errors
      • logSummary

        public void logSummary()
        Writes a summary message to the reports' error log that denotes the total number of errors that have been reported.