Class DefaultLogger

java.lang.Object
com.reposilite.journalist.backend.DefaultLogger
All Implemented Interfaces:
Journalist, Logger
Direct Known Subclasses:
AggregatedLogger, CachedLogger, InMemoryLogger, MultichannelCachedLogger, PrintStreamLogger, PublisherLogger

public abstract class DefaultLogger extends Object implements Logger
Abstract implementation of basic functionalities meant to be extended by a target implementation.
  • Field Details

    • threshold

      protected Channel threshold
  • Constructor Details

    • DefaultLogger

      public DefaultLogger(Channel threshold)
  • Method Details

    • internalLog

      protected abstract void internalLog(Channel channel, String message)
      Internal method used by DefaultLogger to send processed message to the final implementation.
      Parameters:
      channel - the channel to log to
      message - the message to log
    • log

      public Logger log(Channel channel, Object message, Object... arguments)
      Description copied from interface: Logger
      Log the given message to the provided channel
      Specified by:
      log in interface Logger
      Parameters:
      channel - the channel to log to
      message - the message to log
      arguments - arguments to the message
      Returns:
      the logger instance
    • exception

      public Logger exception(Channel channel, Throwable throwable)
      Description copied from interface: Logger
      Log the given exception to the given channel
      Specified by:
      exception in interface Logger
      Parameters:
      channel - the channel to log to
      throwable - the exception to log
      Returns:
      the logger instance
    • setThreshold

      public Logger setThreshold(Channel threshold)
      Description copied from interface: Logger
      Modify current threshold
      Specified by:
      setThreshold in interface Logger
      Parameters:
      threshold - the threshold to set
      Returns:
      the logger instance
    • toPrintStream

      public PrintStream toPrintStream(Channel channel)
      Description copied from interface: Logger
      Create PrintStream that will write to the current logger. Always remember about closing it after usage.
      Specified by:
      toPrintStream in interface Logger
      Returns:
      the associated print stream
    • getLogger

      public Logger getLogger()
      Description copied from interface: Journalist
      Get stored logger
      Specified by:
      getLogger in interface Journalist
      Returns:
      the associated logger