Class MultichannelCachedLogger

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

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

    • MultichannelCachedLogger

      public MultichannelCachedLogger(Channel threshold, int capacity, Set<Channel> channels)
    • MultichannelCachedLogger

      public MultichannelCachedLogger(int capacity, Set<Channel> channels)
      Uses Channel.INFO as a default threshold.
      Parameters:
      capacity - the capacity of messages cache
      channels - list of supported channels
    • MultichannelCachedLogger

      public MultichannelCachedLogger(int capacity)
      Uses Channel.INFO as a default threshold. Uses Channel.getPredefinedChannels() as a default predefined channels.
      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 Map<? extends Channel,? extends List<String>> getMessages()
      Get all stored messages.
      Returns:
      the list of stored messages