Interface Logger

  • All Known Implementing Classes:
    NoopLogger

    public interface Logger
    An object responsible for logging the events of a program.
    Since:
    2
    See Also:
    Event
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean isEnabled​(Event event)
      Returns true if the given event would be logged by this Logger instance.
      void log​(Event0 event)
      Logs the given event that takes no argument.
      <T1> void log​(Event1<T1> event, T1 v1)
      Logs the given event that takes one argument.
      <T1,​T2>
      void
      log​(Event2<T1,​T2> event, T1 v1, T2 v2)
      Logs the given event that takes two arguments.
      <T1,​T2,​T3>
      void
      log​(Event3<T1,​T2,​T3> event, T1 v1, T2 v2, T3 v3)
      Logs the given event that takes three arguments.
      Logger replace​(Logger logger)
      Replaces this instance with the given logger instance if it is possible to do so.
    • Method Detail

      • isEnabled

        boolean isEnabled​(Event event)
        Returns true if the given event would be logged by this Logger instance.
        Parameters:
        event - the event to test
        Returns:
        true if the given event would be logged
      • log

        void log​(Event0 event)
        Logs the given event that takes no argument.
        Parameters:
        event - an event instance
      • log

        <T1> void log​(Event1<T1> event,
                      T1 v1)
        Logs the given event that takes one argument.
        Type Parameters:
        T1 - type of the log argument
        Parameters:
        event - an event instance
        v1 - argument of the logged event
      • log

        <T1,​T2> void log​(Event2<T1,​T2> event,
                               T1 v1,
                               T2 v2)
        Logs the given event that takes two arguments.
        Type Parameters:
        T1 - type of the first log argument
        T2 - type of the second log argument
        Parameters:
        event - an event instance
        v1 - first argument of the logged event
        v2 - second argument of the logged event
      • log

        <T1,​T2,​T3> void log​(Event3<T1,​T2,​T3> event,
                                        T1 v1,
                                        T2 v2,
                                        T3 v3)
        Logs the given event that takes three arguments.
        Type Parameters:
        T1 - type of the first log argument
        T2 - type of the second log argument
        T3 - type of the third log argument
        Parameters:
        event - an event instance
        v1 - first argument of the logged event
        v2 - second argument of the logged event
        v3 - third argument of the logged event
      • replace

        Logger replace​(Logger logger)
        Replaces this instance with the given logger instance if it is possible to do so.
        Parameters:
        logger - a Logger instance that may replace this instance
        Returns:
        the given logger instance or this instance