use of org.gradle.api.logging.configuration.ConsoleOutput in project gradle by gradle.
the class InProcessGradleExecuter method createLoggingManager.
private LoggingManagerInternal createLoggingManager(StartParameter startParameter, OutputStream outputStream, OutputStream errorStream) {
LoggingManagerInternal loggingManager = GLOBAL_SERVICES.getFactory(LoggingManagerInternal.class).create();
loggingManager.captureSystemSources();
ConsoleOutput consoleOutput = startParameter.getConsoleOutput();
loggingManager.attachConsole(new TeeOutputStream(System.out, outputStream), new TeeOutputStream(System.err, errorStream), consoleOutput, consoleAttachment.getConsoleMetaData());
return loggingManager;
}
use of org.gradle.api.logging.configuration.ConsoleOutput in project gradle by gradle.
the class LoggingCommandLineConverter method convert.
public LoggingConfiguration convert(ParsedCommandLine commandLine, LoggingConfiguration loggingConfiguration) throws CommandLineArgumentException {
for (Map.Entry<String, LogLevel> entry : logLevelMap.entrySet()) {
if (commandLine.hasOption(entry.getKey())) {
loggingConfiguration.setLogLevel(entry.getValue());
}
}
for (Map.Entry<String, ShowStacktrace> entry : showStacktraceMap.entrySet()) {
if (commandLine.hasOption(entry.getKey())) {
loggingConfiguration.setShowStacktrace(entry.getValue());
}
}
if (commandLine.hasOption(CONSOLE)) {
String value = commandLine.option(CONSOLE).getValue();
String consoleValue = StringUtils.capitalize(value.toLowerCase(Locale.ENGLISH));
try {
ConsoleOutput consoleOutput = ConsoleOutput.valueOf(consoleValue);
loggingConfiguration.setConsoleOutput(consoleOutput);
} catch (IllegalArgumentException e) {
throw new CommandLineArgumentException(String.format("Unrecognized value '%s' for %s.", value, CONSOLE));
}
}
return loggingConfiguration;
}
use of org.gradle.api.logging.configuration.ConsoleOutput in project gradle by gradle.
the class InProcessGradleExecuter method createLoggingManager.
private LoggingManagerInternal createLoggingManager(StartParameter startParameter, final StandardOutputListener outputListener) {
LoggingManagerInternal loggingManager = GLOBAL_SERVICES.getFactory(LoggingManagerInternal.class).create();
loggingManager.captureSystemSources();
ConsoleOutput consoleOutput = startParameter.getConsoleOutput();
if (consoleOutput == ConsoleOutput.Auto) {
// IDEA runs tests attached to a console, use plain so test can assume never attached to a console
// Should really run all tests against a plain and a rich console to make these assumptions explicit
consoleOutput = ConsoleOutput.Plain;
}
loggingManager.attachConsole(new TeeOutputStream(System.out, new LineBufferingOutputStream(new TextStream() {
@Override
public void text(String text) {
outputListener.onOutput(text);
}
@Override
public void endOfStream(@Nullable Throwable failure) {
}
})), consoleOutput);
return loggingManager;
}
Aggregations