Hi,

I was wondering whether adding something like a @PlatformLog AST transform
would be useful. Has anyone had experience using platform logging[1] yet?

I have an early spike to give a flavour of what it could look like[2]. See
also the Jira issue[3].
Basically, usage would look like this:

////////////////
import groovy.util.logging.*
import static java.lang.System.Logger.Level.INFO

@PlatformLog
class Foo {
    def method() {
        log.log INFO, 'Foobar'
    }
}

new Foo().method()
////////////////

I see the real value in JEP 264 is when we move to a JDK9+ minimum required
version. Then we can switch over to platform logging for all of Groovy's
internal logging. But a @PlatformLog transform would be about exposing it
for users of Groovy too. I imagine we'd provide a way to enable info,
trace, debug, warn style methods too. Perhaps using DGM methods.

Any thoughts?

Thanks, Paul.

[1] https://openjdk.java.net/jeps/264
[2] https://github.com/apache/groovy/pull/1237
[3] https://issues.apache.org/jira/browse/GROOVY-9534

Reply via email to