Class Slf4jInvocationEventEmitter
- All Implemented Interfaces:
InvocationEventEmitter
InvocationEventEmitter that writes each event as a single,
human-readable line through SLF4J.
Successful calls are logged at INFO, failed calls at
WARN, since a failure surfacing through a @Logged method
is operationally significant even though the exception itself already
propagates to the caller. The exception message is never included, only
its simple class name, consistent with MethodInvocationEvent.
The trace id and depth carried by the event are only appended to the
log line when MethodInvocationEvent.depth() is greater than zero,
that is, when the call is part of a chain of nested @Logged
invocations. Root-level, non-nested calls are logged without this extra
detail, keeping the common case concise.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidemit(MethodInvocationEvent event) Publishes the given invocation event to whatever sink this implementation targets.
-
Constructor Details
-
Slf4jInvocationEventEmitter
public Slf4jInvocationEventEmitter()
-
-
Method Details
-
emit
Description copied from interface:InvocationEventEmitterPublishes the given invocation event to whatever sink this implementation targets.Implementations must not throw checked or unchecked exceptions that would propagate back into the intercepted method call. Emission failures (for example a logging backend being unavailable) should be handled internally by the implementation.
- Specified by:
emitin interfaceInvocationEventEmitter- Parameters:
event- the invocation event to publish, nevernull
-