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

Matt Sicker edited comment on LOG4J2-1705 at 2/20/18 10:04 PM:
---------------------------------------------------------------

Coincidentally, I had to learn Kotlin for a gig I just had starting last 
December, so nowadays I'm a bit more comfortable with the language and can 
provide feedback. One thing I'd suggest based on a different Kotlin logging 
framework I tried out is perhaps offering a way to inject the logger into the 
companion object. For example:

{code}
class Foo {
  companion object : Logging

  fun foo() {
    logger.info("Hello, $world")
  }
}
{code}

What's neat is this would be vaguely similar to how the Scala API works as a 
mixin. You can define a val with an initial value in an interface AFAIK, so you 
could offer said Logging mixin for either the class itself or the companion 
object (though via the companion object, we may need custom code to get the 
correct class name for the logger).


was (Author: jvz):
Coincidentally, I had to learn Kotlin for a gig I just had starting last 
December, so nowadays I'm a bit more comfortable with the language and can 
provide feedback. One thing I'd suggest based on a different Kotlin logging 
framework I tried out is perhaps offering a way to inject the logger into the 
companion object. For example:

{code}
class Foo {
  companion object : Logging

  fun foo() {
    logger.info("Hello, $world")
  }
}
{code}

> Kotlin wrapper for Log4j 2 API
> ------------------------------
>
>                 Key: LOG4J2-1705
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1705
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: API
>            Reporter: Raman Gupta
>            Priority: Major
>
> Similar to LOG4J2-1181 for Scala, provide a Kotlin wrapper for the Log4j 2 
> API that makes use of Kotlin features like delegates and string interpolation.
> If there is interest in this, I'd like to contribute a patch.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to