Java 类org.gradle.api.logging.LogLevel 实例源码

项目:Reer    文件:FindBugs.java   
@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);
}
项目:Reer    文件:AntLoggingAdapter.java   
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;
}
项目:Reer    文件:SetupTab.java   
/**
 * 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;
}
项目:Reer    文件:CacheStatisticsReporter.java   
@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");
}
项目:Reer    文件:BuildExceptionReporter.java   
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("==============================================================================");
    }
}
项目:Reer    文件:OutputEventRenderer.java   
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);
    }
}
项目:Reer    文件:ProgressLogEventGenerator.java   
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;
}
项目:Reer    文件:AntLoggingAdapter.java   
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());
    }
}
项目:Reer    文件:BuildExceptionReporter.java   
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.");
    }
}
项目:Reer    文件:DefaultTestLoggingContainer.java   
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));
}
项目:Reer    文件:ProviderConnection.java   
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();
}
项目:Reer    文件:DefaultBuildOperationLogger.java   
private void maybeShowFailure(String output) {
    if (numberOfFailedOperationsSeen < configuration.getMaximumFailedOperationsShown()) {
        logger.log(LogLevel.ERROR, output);
    }
    logWriter.println(output);
    numberOfFailedOperationsSeen++;
}
项目:Reer    文件:AbstractMavenResolver.java   
private void execute(MavenPublishAction publishAction) {
    loggingManager.captureStandardOutput(LogLevel.INFO).start();
    try {
        publishAction.publish();
    } finally {
        loggingManager.stop();
    }
}
项目:Reer    文件:LogEventSerializer.java   
@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);
}
项目:Reer    文件:SetupTab.java   
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 + ")";
    }
}
项目:Reer    文件:ContinuousBuildActionExecuter.java   
ContinuousBuildActionExecuter(BuildActionExecuter<BuildActionParameters> delegate, ListenerManager listenerManager, StyledTextOutputFactory styledTextOutputFactory, OperatingSystem operatingSystem, ExecutorFactory executorFactory, FileSystemChangeWaiterFactory changeWaiterFactory) {
    this.delegate = delegate;
    this.listenerManager = listenerManager;
    this.operatingSystem = operatingSystem;
    this.changeWaiterFactory = changeWaiterFactory;
    this.executorFactory = executorFactory;
    this.logger = styledTextOutputFactory.create(ContinuousBuildActionExecuter.class, LogLevel.LIFECYCLE);
}
项目:Reer    文件:PrintStreamLoggingSystem.java   
@Override
public Snapshot setLevel(LogLevel logLevel) {
    Snapshot snapshot = snapshot();
    if (logLevel != this.logLevel) {
        this.logLevel = logLevel;
        if (enabled) {
            outstr.flush();
            outputEventListener.onOutput(new LogLevelChangeEvent(logLevel));
        }
    }
    return snapshot;
}
项目:Reer    文件:DefaultWorkerProcessFactory.java   
public DefaultWorkerProcessFactory(LogLevel workerLogLevel, MessagingServer server, ClassPathRegistry classPathRegistry, IdGenerator<?> idGenerator,
                                   File gradleUserHomeDir, TemporaryFileProvider temporaryFileProvider, JavaExecHandleFactory execHandleFactory, JvmVersionDetector jvmVersionDetector, OutputEventListener outputEventListener) {
    this.workerLogLevel = workerLogLevel;
    this.server = server;
    this.idGenerator = idGenerator;
    this.gradleUserHomeDir = gradleUserHomeDir;
    this.execHandleFactory = execHandleFactory;
    this.outputEventListener = outputEventListener;
    this.workerFactory = new ApplicationClassesInSystemClassLoaderWorkerFactory(classPathRegistry, temporaryFileProvider, jvmVersionDetector);
}
项目:Reer    文件:OutputEventRenderer.java   
private OutputEventListener onError(final OutputEventListener listener) {
    return new OutputEventListener() {
        public void onOutput(OutputEvent event) {
            if (event.getLogLevel() == LogLevel.ERROR || event.getLogLevel() == null) {
                listener.onOutput(event);
            }
        }
    };
}
项目:Reer    文件:DefaultBuildActionParameters.java   
public DefaultBuildActionParameters(Map<?, ?> systemProperties, Map<String, String> envVariables, File currentDir, LogLevel logLevel, boolean useDaemon, boolean continuous, boolean interactive,
                                    ClassPath injectedPluginClasspath) {
    this.currentDir = currentDir;
    this.logLevel = logLevel;
    this.useDaemon = useDaemon;
    this.continuous = continuous;
    assert systemProperties != null;
    assert envVariables != null;
    this.systemProperties = new HashMap<String, String>();
    GUtil.addToMap(this.systemProperties, systemProperties);
    this.envVariables = new HashMap<String, String>(envVariables);
    this.interactive = interactive;
    this.injectedPluginClasspath = injectedPluginClasspath;
}
项目:shrinker    文件:ShrinkRClassVisitor.java   
@Override
public MethodVisitor visitMethod(int access, String name, String desc,
                                 String signature, String[] exceptions) {
    return new MethodVisitor(Opcodes.ASM5,
            super.visitMethod(access, name, desc, signature, exceptions)) {

        @Override
        public void visitFieldInsn(int opcode, String owner, String fieldName,
                                   String fieldDesc) {
            if (opcode != Opcodes.GETSTATIC || owner.startsWith("java/lang/")) {
                // skip!
                this.mv.visitFieldInsn(opcode, owner, fieldName, fieldDesc);
                return;
            }
            String typeName = owner.substring(owner.lastIndexOf('/') + 1);
            String key = typeName + '.' + fieldName;
            if (rSymbols.containsKey(key)) {
                Integer value = rSymbols.get(key);
                if (value == null)
                    throw new UnsupportedOperationException("value of " + key + " is null!");
                if (logger.isEnabled(LogLevel.DEBUG)) {
                    logger.debug("replace {}.{} to 0x{}", owner, fieldName, Integer.toHexString(value));
                }
                pushInt(this.mv, value);
            } else if (owner.endsWith("/R$styleable")) { // replace all */R$styleable ref!
                this.mv.visitFieldInsn(opcode, RSymbols.R_STYLEABLES_CLASS_NAME, fieldName, fieldDesc);
            } else {
                this.mv.visitFieldInsn(opcode, owner, fieldName, fieldDesc);
            }
        }
    };
}
项目:Reer    文件:DefaultLoggingManager.java   
/**
 * Sets the logging level for this log system. Does not take effect until started .
 */
public void setLevel(LogLevel logLevel) {
    if (this.level == logLevel) {
        return;
    }

    this.level = logLevel;
    if (originalState != null) {
        // started, update the log level
        loggingSystem.setLevel(logLevel);
    }
}
项目:Reer    文件:Test.java   
private LogLevel determineCurrentLogLevel() {
    for (LogLevel level : LogLevel.values()) {
        if (getLogger().isEnabled(level)) {
            return level;
        }
    }
    throw new AssertionError("could not determine current log level");
}
项目:Reer    文件:LogToClient.java   
private AsynchronousLogDispatcher(DaemonConnection conn, final LogLevel buildLogLevel) {
    super("Asynchronous log dispatcher for " + conn);
    this.connection = conn;
    this.listener = new OutputEventListener() {
        public void onOutput(OutputEvent event) {
            if (event.getLogLevel() != null && event.getLogLevel().compareTo(buildLogLevel) >= 0) {
                dispatcher.submit(event);
            }
        }
    };
    LOGGER.debug(DaemonMessages.ABOUT_TO_START_RELAYING_LOGS);
    loggingOutput.addOutputEventListener(listener);
}
项目:Reer    文件:DefaultLoggingManager.java   
@Override
public DefaultLoggingManager setLevelInternal(LogLevel logLevel) {
    slf4jLoggingSystem.setLevel(logLevel);
    javaUtilLoggingSystem.setLevel(logLevel);
    loggingRouter.setLevel(logLevel);
    return this;
}
项目:Reer    文件:DefaultBuildOperationLogger.java   
@Override
public void done() {
    assert started;
    try {
        int suppressedCount = numberOfFailedOperationsSeen - configuration.getMaximumFailedOperationsShown();
        if (suppressedCount > 0) {
            logger.log(LogLevel.ERROR, String.format("...output for %d more failed operation(s) continued in %s.", suppressedCount, getLogLocation()));
        }
        logInBoth(LogLevel.INFO, String.format("Finished %s, see full log %s.", configuration.getTaskName(), getLogLocation()));
    } finally {
        IOUtils.closeQuietly(logWriter);
        started = false;
    }
}
项目:Reer    文件:LoggingServiceRegistry.java   
protected DefaultLoggingManagerFactory createLoggingManagerFactory() {
    OutputEventRenderer renderer = get(OutputEventRenderer.class);
    LoggingSourceSystem stdout = new DefaultStdOutLoggingSystem(getStdoutListener(), get(TimeProvider.class));
    stdout.setLevel(LogLevel.QUIET);
    LoggingSourceSystem stderr = new DefaultStdErrLoggingSystem(new TextStreamOutputEventListener(get(OutputEventListener.class)), get(TimeProvider.class));
    stderr.setLevel(LogLevel.ERROR);
    return new DefaultLoggingManagerFactory(
            renderer,
            new LoggingSystemAdapter(new Slf4jLoggingConfigurer(renderer)),
            new JavaUtilLoggingSystem(),
            stdout,
            stderr);
}
项目:Reer    文件:GradlePluginLord.java   
public void setLogLevel(LogLevel logLevel) {
    if (logLevel == null) {
        return;
    }

    if (areEqual(this.logLevel, logLevel))    //already set to this. This prevents recursive notifications.
    {
        return;
    }
    this.logLevel = logLevel;
    notifySettingsChanged();
}
项目:Reer    文件:LoggingCommandLineConverter.java   
public LoggingCommandLineConverter() {
    logLevelMap.put(QUIET, LogLevel.QUIET);
    logLevelMap.put(INFO, LogLevel.INFO);
    logLevelMap.put(DEBUG, LogLevel.DEBUG);
    showStacktraceMap.put(FULL_STACKTRACE, ShowStacktrace.ALWAYS_FULL);
    showStacktraceMap.put(STACKTRACE, ShowStacktrace.ALWAYS);
}
项目:Reer    文件:DaemonMessageSerializer.java   
public static Serializer<Message> create() {
    BaseSerializerFactory factory = new BaseSerializerFactory();
    Serializer<LogLevel> logLevelSerializer = factory.getSerializerFor(LogLevel.class);
    Serializer<Throwable> throwableSerializer = factory.getSerializerFor(Throwable.class);
    DefaultSerializerRegistry registry = new DefaultSerializerRegistry();

    registry.register(BuildEvent.class, new BuildEventSerializer());
    registry.register(Failure.class, new FailureSerializer(throwableSerializer));

    // Input events
    registry.register(ForwardInput.class, new ForwardInputSerializer());
    registry.register(CloseInput.class, new CloseInputSerializer());

    // Output events
    registry.register(LogEvent.class, new LogEventSerializer(logLevelSerializer, throwableSerializer));
    registry.register(StyledTextOutputEvent.class, new StyledTextOutputEventSerializer(logLevelSerializer, new ListSerializer<StyledTextOutputEvent.Span>(new SpanSerializer(factory.getSerializerFor(StyledTextOutput.Style.class)))));
    registry.register(ProgressStartEvent.class, new ProgressStartEventSerializer());
    registry.register(ProgressCompleteEvent.class, new ProgressCompleteEventSerializer());
    registry.register(ProgressEvent.class, new ProgressEventSerializer());
    registry.register(LogLevelChangeEvent.class, new LogLevelChangeEventSerializer(logLevelSerializer));
    registry.register(OutputMessage.class, new OutputMessageSerializer(registry.build(OutputEvent.class)));

    // Default for everything else
    registry.useJavaSerialization(Message.class);

    return registry.build(Message.class);
}
项目:Reer    文件:DefaultLoggingManager.java   
public void setLevel(LogLevel logLevel) {
    if (this.level == logLevel) {
        return;
    }

    if (originalState != null) {
        // Already started
        loggingRouter.configure(logLevel);
    }
    level = logLevel;
}
项目:Reer    文件:BuildResultLogger.java   
public void buildFinished(BuildResult result) {
    StyledTextOutput textOutput = textOutputFactory.create(BuildResultLogger.class, LogLevel.LIFECYCLE);
    textOutput.println();
    String action = result.getAction().toUpperCase();
    if (result.getFailure() == null) {
        textOutput.withStyle(Success).text(action + " SUCCESSFUL");
    } else {
        textOutput.withStyle(Failure).text(action + " FAILED");
    }
    textOutput.println();
    textOutput.println();
    textOutput.formatln("Total time: %s", buildTimeClock.getElapsed());
}
项目:Reer    文件:LoggingManagerInternalCompatibilityBridge.java   
@Override
public org.gradle.logging.LoggingManagerInternal captureStandardOutput(LogLevel level) {
    delegate.captureStandardOutput(level);
    return this;
}
项目:Reer    文件:TestEventLogger.java   
public TestEventLogger(StyledTextOutputFactory textOutputFactory, LogLevel logLevel, TestLogging testLogging, TestExceptionFormatter exceptionFormatter) {
    super(textOutputFactory, logLevel, testLogging.getDisplayGranularity());
    this.exceptionFormatter = exceptionFormatter;
    this.testLogging = testLogging;
}
项目:Reer    文件:DefaultTestLoggingContainer.java   
@Override
public void setDebug(TestLogging logging) {
    perLevelTestLogging.put(LogLevel.DEBUG, logging);
}
项目:Reer    文件:DefaultTestLoggingContainer.java   
@Override
public TestLogging getInfo() {
    return perLevelTestLogging.get(LogLevel.INFO);
}
项目:Reer    文件:DefaultTestLoggingContainer.java   
@Override
public TestLogging getLifecycle() {
    return perLevelTestLogging.get(LogLevel.LIFECYCLE);
}
项目:Reer    文件:DefaultTestLoggingContainer.java   
@Override
public TestLogging getWarn() {
    return perLevelTestLogging.get(LogLevel.WARN);
}
项目:Reer    文件:LogEvent.java   
public LogEvent(long timestamp, String category, LogLevel logLevel, String message, @Nullable Throwable throwable) {
    super(timestamp, category, logLevel);
    this.message = message;
    this.throwable = throwable;
}
项目:Reer    文件:DefaultTestLoggingContainer.java   
@Override
public void setQuiet(TestLogging logging) {
    perLevelTestLogging.put(LogLevel.QUIET, logging);
}