use of org.gradle.api.logging.configuration.LoggingConfiguration in project gradle by gradle.
the class CommandLineActionFactory method convert.
/**
* <p>Converts the given command-line arguments to an {@link Action} which performs the action requested by the
* command-line args.
*
* @param args The command-line arguments.
* @return The action to execute.
*/
public Action<ExecutionListener> convert(List<String> args) {
ServiceRegistry loggingServices = createLoggingServices();
LoggingConfiguration loggingConfiguration = new DefaultLoggingConfiguration();
return new WithLogging(loggingServices, args, loggingConfiguration, new ExceptionReportingAction(new JavaRuntimeValidationAction(new ParseAndBuildAction(loggingServices, args)), new BuildExceptionReporter(loggingServices.get(StyledTextOutputFactory.class), loggingConfiguration, clientMetaData())));
}
use of org.gradle.api.logging.configuration.LoggingConfiguration in project gradle by gradle.
the class BuildLogLevelMixIn method getBuildLogLevel.
public LogLevel getBuildLogLevel() {
LoggingCommandLineConverter converter = new LoggingCommandLineConverter();
CommandLineParser parser = new CommandLineParser().allowUnknownOptions().allowMixedSubcommandsAndOptions();
converter.configure(parser);
List<String> arguments = parameters.getArguments();
ParsedCommandLine parsedCommandLine = parser.parse(arguments == null ? Collections.<String>emptyList() : arguments);
//configure verbosely only if arguments do not specify any log level.
if (parameters.getVerboseLogging() && !parsedCommandLine.hasAnyOption(converter.getLogLevelOptions())) {
return LogLevel.DEBUG;
}
LoggingConfiguration loggingConfiguration = converter.convert(parsedCommandLine, new DefaultLoggingConfiguration());
return loggingConfiguration.getLogLevel();
}
Aggregations