public interface MethodLogger
A method call logger allowing logging of nested method calls.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Provides String representations of method arguments for log display.static class
Provides String representations of method arguments.static interface
A method logger entry. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
entries()
boolean
static MethodLogger
methodLogger
(int maxSize) Creates a new MethodLogger, disabled by default.static MethodLogger
methodLogger
(int maxSize, MethodLogger.ArgumentToString argumentStringProvider) Creates a new MethodLogger, disabled by default.void
setEnabled
(boolean enabled)
-
Method Details
-
enter
- Parameters:
method
- the method being entered
-
enter
- Parameters:
method
- the method being enteredargument
- the method argument, can be an Object, a collection or an array
-
exit
- Parameters:
method
- the method being exited- Returns:
- the Entry
-
exit
- Parameters:
method
- the method being exitedexception
- the exception, if any- Returns:
- the Entry
-
exit
- Parameters:
method
- the method being exitedexception
- the exception, if anyexitMessage
- 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
List<MethodLogger.Entry> entries()- Returns:
- an unmodifiable view of the log entries
-
methodLogger
Creates a new MethodLogger, disabled by default.- Parameters:
maxSize
- the maximum log size- Returns:
- a new MethodLogger instance
-
methodLogger
Creates a new MethodLogger, disabled by default.- Parameters:
maxSize
- the maximum log sizeargumentStringProvider
- responsible for providing String representations of method arguments- Returns:
- a new MethodLogger instance
-