本文整理汇总了Java中org.gradle.api.logging.LogLevel类的典型用法代码示例。如果您正苦于以下问题:Java LogLevel类的具体用法?Java LogLevel怎么用?Java LogLevel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LogLevel类属于org.gradle.api.logging包,在下文中一共展示了LogLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
@TaskAction
public void run() throws IOException, InterruptedException {
new FindBugsClasspathValidator(JavaVersion.current()).validateClasspath(
Iterables.transform(getFindbugsClasspath().getFiles(), new Function<File, String>() {
@Override
public String apply(File input) {
return input.getName();
}
}));
FindBugsSpec spec = generateSpec();
FindBugsWorkerManager manager = new FindBugsWorkerManager();
getLogging().captureStandardOutput(LogLevel.DEBUG);
getLogging().captureStandardError(LogLevel.DEBUG);
FindBugsResult result = manager.runWorker(getProject().getProjectDir(), getWorkerProcessBuilderFactory(), getFindbugsClasspath(), spec);
evaluateResult(result);
}
示例2: getLogLevelForMessagePriority
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
private LogLevel getLogLevelForMessagePriority(int messagePriority) {
LogLevel defaultLevel = LogLevelMapping.ANT_IVY_2_SLF4J.get(messagePriority);
// Check to see if we should adjust the level based on a set lifecycle log level
if (lifecycleLogLevel != null) {
if (defaultLevel.ordinal() < LogLevel.LIFECYCLE.ordinal()
&& AntMessagePriority.from(messagePriority).ordinal() >= lifecycleLogLevel.ordinal()) {
// we would normally log at a lower level than lifecycle, but the Ant message priority is actually higher
// than (or equal to) the set lifecycle log level
return LogLevel.LIFECYCLE;
} else if (defaultLevel.ordinal() >= LogLevel.LIFECYCLE.ordinal()
&& AntMessagePriority.from(messagePriority).ordinal() < lifecycleLogLevel.ordinal()) {
// would normally log at a level higher than (or equal to) lifecycle, but the Ant message priority is
// actually lower than the set lifecycle log level
return LogLevel.INFO;
}
}
return defaultLevel;
}
示例3: getLogLevelWrappers
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
/**
* This creates an array of wrapper objects suitable for passing to the constructor of the log level combo box.
*/
private Vector<LogLevelWrapper> getLogLevelWrappers() {
Collection<LogLevel> collection = new LoggingCommandLineConverter().getLogLevels();
Vector<LogLevelWrapper> wrappers = new Vector<LogLevelWrapper>();
Iterator<LogLevel> iterator = collection.iterator();
while (iterator.hasNext()) {
LogLevel level = iterator.next();
wrappers.add(new LogLevelWrapper(level));
}
Collections.sort(wrappers, new Comparator<LogLevelWrapper>() {
public int compare(LogLevelWrapper o1, LogLevelWrapper o2) {
return o1.toString().compareToIgnoreCase(o2.toString());
}
});
return wrappers;
}
示例4: buildFinished
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
@Override
public void buildFinished(TaskExecutionStatistics statistics) {
StyledTextOutput textOutput = textOutputFactory.create(BuildResultLogger.class, LogLevel.LIFECYCLE);
textOutput.println();
int allTasks = statistics.getAllTasksCount();
int allExecutedTasks = statistics.getTasksCount(TaskExecutionOutcome.EXECUTED);
int skippedTasks = statistics.getTasksCount(TaskExecutionOutcome.SKIPPED);
int upToDateTasks = statistics.getTasksCount(TaskExecutionOutcome.UP_TO_DATE);
int fromCacheTasks = statistics.getTasksCount(TaskExecutionOutcome.FROM_CACHE);
int cacheableExecutedTasks = statistics.getCacheMissCount();
int nonCacheableExecutedTasks = allExecutedTasks - cacheableExecutedTasks;
textOutput.formatln("%d tasks in build, out of which %d (%d%%) were executed", allTasks, allExecutedTasks, roundedPercentOf(allExecutedTasks, allTasks));
statisticsLine(textOutput, skippedTasks, allTasks, "skipped");
statisticsLine(textOutput, upToDateTasks, allTasks, "up-to-date");
statisticsLine(textOutput, fromCacheTasks, allTasks, "loaded from cache");
statisticsLine(textOutput, cacheableExecutedTasks, allTasks, "cache miss");
statisticsLine(textOutput, nonCacheableExecutedTasks, allTasks, "not cacheable");
}
示例5: renderMultipleBuildExceptions
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
private void renderMultipleBuildExceptions(MultipleBuildFailures multipleFailures) {
List<? extends Throwable> causes = multipleFailures.getCauses();
StyledTextOutput output = textOutputFactory.create(BuildExceptionReporter.class, LogLevel.ERROR);
output.println();
output.withStyle(Failure).format("FAILURE: Build completed with %s failures.", causes.size());
output.println();
for (int i = 0; i < causes.size(); i++) {
Throwable cause = causes.get(i);
FailureDetails details = constructFailureDetails("Task", cause);
output.println();
output.withStyle(Failure).format("%s: ", i + 1);
details.summary.writeTo(output.withStyle(Failure));
output.println();
output.text("-----------");
writeFailureDetails(output, details);
output.println("==============================================================================");
}
}
示例6: onOutput
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
public void onOutput(OutputEvent event) {
synchronized (lock) {
if (event.getLogLevel() != null && event.getLogLevel().compareTo(logLevel) < 0) {
return;
}
if (event instanceof LogLevelChangeEvent) {
LogLevelChangeEvent changeEvent = (LogLevelChangeEvent) event;
LogLevel newLogLevel = changeEvent.getNewLogLevel();
if (newLogLevel == this.logLevel) {
return;
}
this.logLevel = newLogLevel;
}
formatters.getSource().onOutput(event);
}
}
示例7: completeHeader
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
public void completeHeader() {
switch (state) {
case None:
if (hasLoggingHeader) {
listener.onOutput(new StyledTextOutputEvent(startTime, category, LogLevel.LIFECYCLE, loggingHeader + EOL));
}
break;
case HeaderStarted:
listener.onOutput(new StyledTextOutputEvent(startTime, category, LogLevel.LIFECYCLE, EOL));
break;
case HeaderCompleted:
return;
default:
throw new IllegalStateException("state is " + state);
}
state = State.HeaderCompleted;
}
示例8: messageLogged
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
public void messageLogged(BuildEvent event) {
final StringBuffer message = new StringBuffer();
if (event.getTask() != null) {
String taskName = event.getTask().getTaskName();
message.append("[ant:").append(taskName).append("] ");
}
final String messageText = event.getMessage();
message.append(messageText);
LogLevel level = getLogLevelForMessagePriority(event.getPriority());
if (event.getException() != null) {
logger.log(level, message.toString(), event.getException());
} else {
logger.log(level, message.toString());
}
}
示例9: fillInFailureResolution
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
private void fillInFailureResolution(FailureDetails details) {
if (details.failure instanceof FailureResolutionAware) {
((FailureResolutionAware) details.failure).appendResolution(details.resolution, clientMetaData);
if (details.resolution.getHasContent()) {
details.resolution.append(' ');
}
}
if (details.exceptionStyle == ExceptionStyle.NONE) {
details.resolution.text("Run with ");
details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.STACKTRACE_LONG);
details.resolution.text(" option to get the stack trace. ");
}
if (loggingConfiguration.getLogLevel() != LogLevel.DEBUG) {
details.resolution.text("Run with ");
if (loggingConfiguration.getLogLevel() != LogLevel.INFO) {
details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.INFO_LONG);
details.resolution.text(" or ");
}
details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.DEBUG_LONG);
details.resolution.text(" option to get more log output.");
}
}
示例10: DefaultTestLoggingContainer
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
public DefaultTestLoggingContainer(Instantiator instantiator) {
for (LogLevel level: LogLevel.values()) {
perLevelTestLogging.put(level, instantiator.newInstance(DefaultTestLogging.class));
}
setEvents(EnumSet.of(TestLogEvent.FAILED));
setExceptionFormat(TestExceptionFormat.SHORT);
getInfo().setEvents(EnumSet.of(TestLogEvent.FAILED, TestLogEvent.SKIPPED, TestLogEvent.STANDARD_OUT, TestLogEvent.STANDARD_ERROR));
getInfo().setStackTraceFilters(EnumSet.of(TestStackTraceFilter.TRUNCATE));
getDebug().setEvents(EnumSet.allOf(TestLogEvent.class));
getDebug().setMinGranularity(0);
getDebug().setStackTraceFilters(EnumSet.noneOf(TestStackTraceFilter.class));
}
示例11: configure
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
public void configure(ProviderConnectionParameters parameters) {
LogLevel providerLogLevel = parameters.getVerboseLogging() ? LogLevel.DEBUG : LogLevel.INFO;
LOGGER.debug("Configuring logging to level: {}", providerLogLevel);
LoggingManagerInternal loggingManager = loggingServices.newInstance(LoggingManagerInternal.class);
loggingManager.setLevelInternal(providerLogLevel);
loggingManager.start();
}
示例12: maybeShowFailure
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
private void maybeShowFailure(String output) {
if (numberOfFailedOperationsSeen < configuration.getMaximumFailedOperationsShown()) {
logger.log(LogLevel.ERROR, output);
}
logWriter.println(output);
numberOfFailedOperationsSeen++;
}
示例13: execute
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
private void execute(MavenPublishAction publishAction) {
loggingManager.captureStandardOutput(LogLevel.INFO).start();
try {
publishAction.publish();
} finally {
loggingManager.stop();
}
}
示例14: read
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
@Override
public LogEvent read(Decoder decoder) throws Exception {
long timestamp = decoder.readLong();
String category = decoder.readString();
LogLevel logLevel = logLevelSerializer.read(decoder);
String message = decoder.readString();
Throwable throwable = throwableSerializer.read(decoder);
return new LogEvent(timestamp, category, logLevel, message, throwable);
}
示例15: LogLevelWrapper
import org.gradle.api.logging.LogLevel; //导入依赖的package包/类
private LogLevelWrapper(LogLevel logLevel) {
this.logLevel = logLevel;
String temp = logLevel.toString().toLowerCase().replace('_', ' '); //replace underscores in the name with spaces
this.toString = Character.toUpperCase(temp.charAt(0)) + temp.substring(1);
//add the command line character to the end (so if an error message says use a log level, you can easily translate)
String commandLineCharacter = new LoggingCommandLineConverter().getLogLevelCommandLine(logLevel);
if (commandLineCharacter != null && !commandLineCharacter.equals("")) {
this.toString += " (-" + commandLineCharacter + ")";
}
}