[
https://issues.jboss.org/browse/LOGTOOL-83?page=com.atlassian.jira.plugin...
]
David Lloyd commented on LOGTOOL-83:
------------------------------------
I've gotten more requests for this feature. Here's how I think it should be
done.
Introduce a {{@Once}} annotation. If the annotation is present on a log method, create a
final *instance* field of type {{AtomicBoolean}} whose name is associated with the log
method name (ensuring that overloaded methods are handled correctly, such that only one
variable is created for all overloads). Then wrap the corresponding method body in a
block like this:
{code}
void theLogMethod(String foo, int bar) {
if (theLogMethod_$Once.compareAndSet(false, true) {
// ... original method body goes here ...
}
}
{code}
Maybe some future version could get fancy with a SwitchPoint or something, but that's
something that can be explored later.
Ability to annotate @LogMessage as "log once"
---------------------------------------------
Key: LOGTOOL-83
URL:
https://issues.jboss.org/browse/LOGTOOL-83
Project: Log Tool
Issue Type: Feature Request
Reporter: Steve Ebersole
Assignee: James Perkins
Ideally via an optional annotation ({{@LogOnce}}?)
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)