[jboss-jira] [JBoss JIRA] (LOGTOOL-47) Add custom stringifier option

James Perkins (JIRA) jira-events at lists.jboss.org
Wed Apr 25 11:41:20 EDT 2012


    [ https://issues.jboss.org/browse/LOGTOOL-47?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12687689#comment-12687689 ] 

James Perkins commented on LOGTOOL-47:
--------------------------------------

The @FormatWith annotation already exists in JBL, [https://github.com/jboss-logging/jboss-logging/blob/master/src/main/java/org/jboss/logging/FormatWith.java]
                
> Add custom stringifier option
> -----------------------------
>
>                 Key: LOGTOOL-47
>                 URL: https://issues.jboss.org/browse/LOGTOOL-47
>             Project: Log Tool
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>            Reporter: David Lloyd
>             Fix For: 1.1.0.Beta1
>
>
> Sometimes the default toString is no good for formatting an argument.  We could introduce an interface into jboss-logging:
> {code}
> public interface Stringifier {
>     String toString(Object object);
> }
> {code}
> Then we could introduce the following annotation:
> {code}
> @Retention(SOURCE)
> @Target(PARAMETER)
> public @interface FormatWith {
>     Class<? extends Stringifier> value();
> }
> {code}
> Parameters so annotated will be formatted using an instance (singleton, pre-instantiated with the logger instance) of the stringifier.  Because of the method call overhead, such methods would require an explicit level check in the generated code.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list