public class AbstractLogger extends Object
Modifier and Type | Class and Description |
---|---|
protected static interface |
AbstractLogger.Callable
Type of thunk used in
execute(Callable, String, Object[]) |
protected static interface |
AbstractLogger.SafeCallable
Type of thunk used in
execute(SafeCallable, String, Object[]) |
Modifier and Type | Field and Description |
---|---|
protected LogWriter |
writer
The
LogWriter used by this instance for persisting log messages. |
Constructor and Description |
---|
AbstractLogger(LogWriter writer)
Create a new instance of this log wrapper which uses
writer
for persisting log messages. |
Modifier and Type | Method and Description |
---|---|
protected Object |
execute(AbstractLogger.Callable thunk,
String methodName,
Object[] args)
Execute a
thunk of a method which might throw a RepositoryException . |
protected Object |
execute(AbstractLogger.SafeCallable thunk,
String methodName,
Object[] args)
Execute a
thunk of a method which does not throw any checked exception. |
public AbstractLogger(LogWriter writer)
writer
for persisting log messages.writer
- protected Object execute(AbstractLogger.Callable thunk, String methodName, Object[] args) throws RepositoryException
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.thunk
- thunk of the method to executemethodName
- the name of the methodargs
- the arguments passed to the methodthunk
RepositoryException
- if executing the thunk
throws an Exception the
exception is re-thrown.protected Object execute(AbstractLogger.SafeCallable thunk, String methodName, Object[] args)
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.thunk
- thunk of the method to executemethodName
- the name of the methodargs
- the arguments passed to the methodthunk
Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.