Class CachedLogger

java.lang.Object
com.reposilite.journalist.backend.DefaultLogger
com.reposilite.journalist.backend.CachedLogger
All Implemented Interfaces:
Journalist, Logger

public class CachedLogger extends DefaultLogger
Stores all messages in memory as a queue with limit and does not print any message directly.
  • Constructor Details

    • CachedLogger

      public CachedLogger(Channel threshold, int capacity)
    • CachedLogger

      public CachedLogger(int capacity)
      Uses Channel.INFO as a default threshold.
      Parameters:
      capacity - the capacity of messages cache
  • Method Details

    • internalLog

      protected void internalLog(Channel channel, String message)
      Description copied from class: DefaultLogger
      Internal method used by DefaultLogger to send processed message to the final implementation.
      Specified by:
      internalLog in class DefaultLogger
      Parameters:
      channel - the channel to log to
      message - the message to log
    • contains

      public boolean contains(String message)
      Check if one of the stored messages contain the given text.
      Parameters:
      message - the text to search for
      Returns:
      true if any stored message contains the given value, otherwise false
    • find

      Find entry with message and channel related to it.
      Parameters:
      filter - the predicate for the channel or the message of the entry
      Returns:
      the entry of the given predicate
    • getMessages

      public List<? extends Map.Entry<Channel,String>> getMessages()
      Get all stored messages.
      Returns:
      the list of stored messages