Class LoggingBuffer


  • public class LoggingBuffer
    extends Object
    This class keeps the last N lines in a buffer
    Author:
    matt
    • Constructor Detail

      • LoggingBuffer

        public LoggingBuffer​(int bufferSize)
    • Method Detail

      • getLastBufferLineNr

        public int getLastBufferLineNr()
        Returns:
        the number (sequence, 1..N) of the last log line. If no records are present in the buffer, 0 is returned.
      • getLogBufferFromTo

        public List<KettleLoggingEvent> getLogBufferFromTo​(List<String> channelId,
                                                           boolean includeGeneral,
                                                           int from,
                                                           int to)
        Parameters:
        channelId - channel IDs to grab
        includeGeneral - include general log lines
        from -
        to -
        Returns:
      • getLogBufferFromTo

        public List<KettleLoggingEvent> getLogBufferFromTo​(String parentLogChannelId,
                                                           boolean includeGeneral,
                                                           int from,
                                                           int to)
        Parameters:
        parentLogChannelId - the parent log channel ID to grab
        includeGeneral - include general log lines
        from -
        to -
        Returns:
      • getBuffer

        public StringBuffer getBuffer​(String parentLogChannelId,
                                      boolean includeGeneral,
                                      int startLineNr,
                                      int endLineNr)
      • getBuffer

        public StringBuffer getBuffer​(String parentLogChannelId,
                                      boolean includeGeneral)
      • getBuffer

        public StringBuffer getBuffer​(String parentLogChannelId,
                                      boolean includeGeneral,
                                      int startLineNr)
      • close

        public void close()
      • setName

        public void setName​(String name)
      • getName

        public String getName()
      • requiresLayout

        public boolean requiresLayout()
      • clear

        public void clear()
      • getMaxNrLines

        public int getMaxNrLines()
        Returns:
        the maximum number of lines that this buffer contains, 0 or lower means: no limit
      • setMaxNrLines

        public void setMaxNrLines​(int maxNrLines)
        Parameters:
        maxNrLines - the maximum number of lines that this buffer should contain, 0 or lower means: no limit
      • getNrLines

        public int getNrLines()
        Returns:
        the nrLines
      • removeChannelFromBuffer

        public void removeChannelFromBuffer​(String id)
        Removes all rows for the channel with the specified id
        Parameters:
        id - the id of the logging channel to remove
      • size

        public int size()
      • removeGeneralMessages

        public void removeGeneralMessages()
      • getBufferIterator

        @Deprecated
        public Iterator<BufferLine> getBufferIterator()
        Deprecated.
        We should not expose iterator out of the class. Looks like it's only used in tests. Marked deprecated for now. TODO: To be made package-level in future.
      • dump

        @Deprecated
        public String dump()
        Deprecated.
        It looks like this method is not used in the project.
      • removeBufferLinesBefore

        public void removeBufferLinesBefore​(long minTimeBoundary)