[ 
https://issues.apache.org/jira/browse/LOG4J2-1255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15326392#comment-15326392
 ] 

Mikael Ståldal commented on LOG4J2-1255:
----------------------------------------

I am looking at how to do this in the Scala API I am working on. What about 
this:

(Quick Scala intro: types goes after variables/methods/parameters, {{Unit}} is 
like {{void}} in Java, {{AnyRef}} is like {{Object}} in Java, the {{*}} is 
varargs)

{code}
class Logger(val delegate: ExtendedLogger) {

  // other stuff...

  def traceEntry(): EntryMessage = delegate.traceEntry()

  def traceEntry(params: AnyRef*): EntryMessage =
    delegate.traceEntry(null, params) // TODO this should be a macro to avoid 
varargs array creation when trace is not enabled

  def traceEntry(message: Message): EntryMessage = delegate.traceEntry(message)

  def traceExit[R](result: R): R = delegate.traceExit(result)

  def traceExit(): Unit = delegate.traceExit()

  def traceExit(entryMessage: EntryMessage): Unit = 
delegate.traceExit(entryMessage)

  // maybe this also? 
  def traceExit(message: Message): Unit = delegate.traceExit(message)

  def traceExit[R](entryMessage: EntryMessage, result: R): R = 
delegate.traceExit(entryMessage, result)

  def traceExit[R](message: Message, result: R): R = 
delegate.traceExit(message, result)

}
{code}


> Logger.entry and Logger.exit should support Messages.
> -----------------------------------------------------
>
>                 Key: LOG4J2-1255
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1255
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: API
>    Affects Versions: 2.5
>            Reporter: Ralph Goers
>            Assignee: Ralph Goers
>             Fix For: 2.6
>
>
> Logger.entry and Logger.exit currently do not support Message objects. This 
> reduces the flexibility of what can be logged on entry and exit to methods.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to