Get a logger in a Settings plugin


#1

I am writing a settings plugin for internal use. I can’t figure out how to get a logger. In a Project plugin you can get it with “project.getLogger()” (assuming you named the variable project of course).

The Settings class doesn’t offer a getLogger() method. I assume it is possible because in a settings.gradle file you can do “logger.quiet(“blah”)” just fine.

How do a get a logger from Settings?

class AwesomeSettingsPlugin implements Plugin<Settings> {

     @Override
     void apply(Settings settings) {
        //How do I get a logger here :-( 
     }
}

EDIT: Settings.useLogger() with a StandardOutputListener looks promising, I will give that a go