Search in sources :

Example 1 with DefaultLoggingConfiguration

use of org.gradle.internal.logging.DefaultLoggingConfiguration 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())));
}
Also used : StyledTextOutputFactory(org.gradle.internal.logging.text.StyledTextOutputFactory) LoggingConfiguration(org.gradle.api.logging.configuration.LoggingConfiguration) DefaultLoggingConfiguration(org.gradle.internal.logging.DefaultLoggingConfiguration) DefaultLoggingConfiguration(org.gradle.internal.logging.DefaultLoggingConfiguration) ServiceRegistry(org.gradle.internal.service.ServiceRegistry) LoggingServiceRegistry(org.gradle.internal.logging.services.LoggingServiceRegistry) BuildExceptionReporter(org.gradle.internal.buildevents.BuildExceptionReporter)

Example 2 with DefaultLoggingConfiguration

use of org.gradle.internal.logging.DefaultLoggingConfiguration 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();
}
Also used : DefaultLoggingConfiguration(org.gradle.internal.logging.DefaultLoggingConfiguration) LoggingConfiguration(org.gradle.api.logging.configuration.LoggingConfiguration) DefaultLoggingConfiguration(org.gradle.internal.logging.DefaultLoggingConfiguration) LoggingCommandLineConverter(org.gradle.internal.logging.LoggingCommandLineConverter) ParsedCommandLine(org.gradle.cli.ParsedCommandLine) CommandLineParser(org.gradle.cli.CommandLineParser)

Aggregations

LoggingConfiguration (org.gradle.api.logging.configuration.LoggingConfiguration)2 DefaultLoggingConfiguration (org.gradle.internal.logging.DefaultLoggingConfiguration)2 CommandLineParser (org.gradle.cli.CommandLineParser)1 ParsedCommandLine (org.gradle.cli.ParsedCommandLine)1 BuildExceptionReporter (org.gradle.internal.buildevents.BuildExceptionReporter)1 LoggingCommandLineConverter (org.gradle.internal.logging.LoggingCommandLineConverter)1 LoggingServiceRegistry (org.gradle.internal.logging.services.LoggingServiceRegistry)1 StyledTextOutputFactory (org.gradle.internal.logging.text.StyledTextOutputFactory)1 ServiceRegistry (org.gradle.internal.service.ServiceRegistry)1