Package com.tnsai.annotations
Annotation Interface AuditLog
Records method invocations to an audit trail.
Usage
@AuditLog(action = "user.approve")
public void approveUser(String userId) { }
@AuditLog(action = "config.change", includeArgs = true)
public void updateConfig(String key, String value) { }
An action's own @AuditLog applies, else the first found on a method it overrides, walking the target's
class and each superclass up the chain, then the interfaces of those classes from the topmost superclass's down to
the target class's own, each class's interfaces in declaration order, depth-first through the interfaces each
extends, skipping an interface already walked. An override that does not repeat it is therefore still audited, once.
- Since:
- 0.3.0
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhether to include method arguments in the audit record.booleanWhether to include the return value in the audit record.
-
Element Details
-
action
String actionAction name for the audit entry (e.g., "user.approve", "config.change").- Returns:
- action name
-
includeArgs
boolean includeArgsWhether to include method arguments in the audit record.- Returns:
- true to log args (default: false)
- Default:
false
-
includeResult
boolean includeResultWhether to include the return value in the audit record.- Returns:
- true to log result (default: false)
- Default:
false
-