Class AbstractLogger

    • Field Detail

      • writer

        protected final LogWriter writer
        The LogWriter used by this instance for persisting log messages.
    • Constructor Detail

      • AbstractLogger

        public AbstractLogger​(LogWriter writer)
        Create a new instance of this log wrapper which uses writer for persisting log messages.
        Parameters:
        writer -
    • Method Detail

      • execute

        protected Object execute​(AbstractLogger.Callable thunk,
                                 String methodName,
                                 Object[] args)
                          throws RepositoryException
        Execute a thunk of a method which might throw a RepositoryException. The call is logged to writer right before it is actually performed and after it returns. Any exception thrown by the call is logged before it is re-thrown.
        Parameters:
        thunk - thunk of the method to execute
        methodName - the name of the method
        args - the arguments passed to the method
        Returns:
        the value returned from executing the thunk
        Throws:
        RepositoryException - if executing the thunk throws an Exception the exception is re-thrown.
      • execute

        protected Object execute​(AbstractLogger.SafeCallable thunk,
                                 String methodName,
                                 Object[] args)
        Execute a thunk of a method which does not throw any checked exception. The call is logged to writer right before it is actually performed and after it returns.
        Parameters:
        thunk - thunk of the method to execute
        methodName - the name of the method
        args - the arguments passed to the method
        Returns:
        the value returned from executing the thunk