Interface MethodLogger


public interface MethodLogger
A method call logger allowing logging of nested method calls.
See Also:
  • Method Details

    • enter

      void enter(String method)
      Parameters:
      method - the method being entered
    • enter

      void enter(String method, Object argument)
      Parameters:
      method - the method being entered
      argument - the method argument, can be an Object, a collection or an array
    • exit

      MethodLogger.Entry exit(String method)
      Parameters:
      method - the method being exited
      Returns:
      the Entry
    • exit

      MethodLogger.Entry exit(String method, Exception exception)
      Parameters:
      method - the method being exited
      exception - the exception, if any
      Returns:
      the Entry
    • exit

      MethodLogger.Entry exit(String method, Exception exception, String exitMessage)
      Parameters:
      method - the method being exited
      exception - the exception, if any
      exitMessage - the message to associate with exiting the method
      Returns:
      the Entry, or null if this logger is not enabled
    • isEnabled

      boolean isEnabled()
      Returns:
      true if this logger is enabled
    • setEnabled

      void setEnabled(boolean enabled)
      Parameters:
      enabled - true to enable this logger
    • entries

      Returns:
      an unmodifiable view of the log entries
    • methodLogger

      static MethodLogger methodLogger(int maxSize)
      Creates a new MethodLogger, disabled by default.
      Parameters:
      maxSize - the maximum log size
      Returns:
      a new MethodLogger instance
    • methodLogger

      static MethodLogger methodLogger(int maxSize, MethodLogger.ArgumentToString argumentStringProvider)
      Creates a new MethodLogger, disabled by default.
      Parameters:
      maxSize - the maximum log size
      argumentStringProvider - responsible for providing String representations of method arguments
      Returns:
      a new MethodLogger instance