当前位置: 首页>>代码示例>>Java>>正文


Java OutputEvent类代码示例

本文整理汇总了Java中org.gradle.internal.logging.events.OutputEvent的典型用法代码示例。如果您正苦于以下问题:Java OutputEvent类的具体用法?Java OutputEvent怎么用?Java OutputEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OutputEvent类属于org.gradle.internal.logging.events包,在下文中一共展示了OutputEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onOutput

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
public void onOutput(OutputEvent event) {
    if (event instanceof LogLevelChangeEvent) {
        LogLevelChangeEvent changeEvent = (LogLevelChangeEvent) event;
        debugOutput = changeEvent.getNewLogLevel() == LogLevel.DEBUG;
    }
    if (event instanceof RenderableOutputEvent) {
        RenderableOutputEvent outputEvent = (RenderableOutputEvent) event;
        textOutput.style(outputEvent.getLogLevel() == LogLevel.ERROR ? Error : Normal);
        if (debugOutput && (textOutput.atEndOfLine || lastEvent == null || !lastEvent.getCategory().equals(outputEvent.getCategory()))) {
            if (!textOutput.atEndOfLine) {
                textOutput.println();
            }
            textOutput.text(dateFormat.format(new Date(outputEvent.getTimestamp())));
            textOutput.text(" [");
            textOutput.text(outputEvent.getLogLevel());
            textOutput.text("] [");
            textOutput.text(outputEvent.getCategory());
            textOutput.text("] ");
        }
        outputEvent.render(textOutput);
        lastEvent = outputEvent;
        textOutput.style(Normal);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:25,代码来源:StyledTextOutputBackedRenderer.java

示例2: onOutput

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:OutputEventRenderer.java

示例3: run

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
@Override
public void run() {
    OutputEvent event;
    try {
        while (!shouldStop) {
            // we must not use interrupt() because it would automatically
            // close the connection (sending data from an interrupted thread
            // automatically closes the connection)
            event = eventQueue.poll(10, TimeUnit.MILLISECONDS);
            if (event != null) {
                dispatchAsync(event);
            }
        }
    } catch (InterruptedException ex) {
        shouldStop = true;
    }
    sendRemainingEvents();
    completionLock.countDown();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:LogToClient.java

示例4: onOutput

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
public void onOutput(OutputEvent newEvent) {
    synchronized (lock) {
        queue.add(newEvent);

        if (newEvent instanceof EndOutputEvent) {
            // Flush and clean up
            renderNow(timeProvider.getCurrentTime());
            executor.shutdown();
            return;
        }

        if (queue.size() > 1) {
            // Currently queuing events, a thread is scheduled to flush the queue later
            return;
        }

        long now = timeProvider.getCurrentTime();
        if (now - lastUpdate >= throttleMs) {
            // Has been long enough since last update - flush now
            renderNow(now);
            return;
        }

        // This is the first queued event - schedule a thread to flush later
        executor.schedule(new Runnable() {
            @Override
            public void run() {
                synchronized (lock) {
                    renderNow(timeProvider.getCurrentTime());
                }
            }
        }, throttleMs, TimeUnit.MILLISECONDS);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:35,代码来源:ConsoleBackedProgressRenderer.java

示例5: renderNow

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
private void renderNow(long now) {
    if (queue.isEmpty()) {
        // Already rendered - don't update anything
        return;
    }

    ProgressOperation lastOp = mostRecentOperation;
    for (OutputEvent event : queue) {
        try {
            if (event instanceof ProgressStartEvent) {
                ProgressStartEvent startEvent = (ProgressStartEvent) event;
                lastOp = operations.start(startEvent.getShortDescription(), startEvent.getStatus(), startEvent.getOperationId(), startEvent.getParentId());
            } else if (event instanceof ProgressCompleteEvent) {
                ProgressOperation op = operations.complete(((ProgressCompleteEvent) event).getOperationId());
                lastOp = op.getParent();
            } else if (event instanceof ProgressEvent) {
                ProgressEvent progressEvent = (ProgressEvent) event;
                lastOp = operations.progress(progressEvent.getStatus(), progressEvent.getOperationId());
            }
            listener.onOutput(event);
        } catch (Exception e) {
            throw new RuntimeException("Unable to process incoming event '" + event + "' (" + event.getClass().getSimpleName() + ")", e);
        }
    }
    if (lastOp != null) {
        getStatusBar().setText(statusBarFormatter.format(lastOp));
    } else if (mostRecentOperation != null) {
        getStatusBar().setText("");
    }
    console.flush();
    mostRecentOperation = lastOp;
    queue.clear();
    lastUpdate = now;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:35,代码来源:ConsoleBackedProgressRenderer.java

示例6: onOutput

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
public void onOutput(OutputEvent event) {
    if (event instanceof StyledTextOutputEvent) {
        onTextEvent((StyledTextOutputEvent) event);
    } else if (event instanceof LogLevelChangeEvent) {
        onLogLevelChange((LogLevelChangeEvent) event);
    } else {
        throw new IllegalArgumentException();
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:TextStreamOutputEventListener.java

示例7: onError

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
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);
            }
        }
    };
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:OutputEventRenderer.java

示例8: onNonError

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
private OutputEventListener onNonError(final OutputEventListener listener) {
    return new OutputEventListener() {
        public void onOutput(OutputEvent event) {
            if (event.getLogLevel() != LogLevel.ERROR || event.getLogLevel() == null) {
                listener.onOutput(event);
            }
        }
    };
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:OutputEventRenderer.java

示例9: create

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:28,代码来源:DaemonMessageSerializer.java

示例10: AsynchronousLogDispatcher

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:LogToClient.java

示例11: dispatchAsync

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
private void dispatchAsync(OutputEvent event) {
    if (unableToSend) {
        return;
    }
    try {
        connection.logEvent(event);
    } catch (Exception ex) {
        shouldStop = true;
        unableToSend = true;
        //Ignore. It means the client has disconnected so no point sending him any log output.
        //we should be checking if client still listens elsewhere anyway.
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:LogToClient.java

示例12: onOutput

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
public void onOutput(OutputEvent event) {
    if (event instanceof ProgressStartEvent) {
        ProgressStartEvent startEvent = (ProgressStartEvent) event;
        progressListener.onOperationStart(startEvent.getDescription());
    } else if (event instanceof ProgressCompleteEvent) {
        progressListener.onOperationEnd();
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:LoggingBridgingBuildActionExecuter.java

示例13: onOutput

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
@Override
public void onOutput(OutputEvent event) {
    if (event instanceof LogEvent) {
        workerLoggingProtocol.sendOutputEvent((LogEvent) event);
    } else if (event instanceof StyledTextOutputEvent) {
        workerLoggingProtocol.sendOutputEvent((StyledTextOutputEvent) event);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:WorkerLogEventListener.java

示例14: onOutput

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
@Override
public void onOutput(OutputEvent outputEvent) {
    checkNotNull(outputEvent);
    if (outputEvent instanceof LogEvent) {
        logEvents.add((LogEvent) outputEvent);
    }
}
 
开发者ID:nebula-plugins,项目名称:gradle-metrics-plugin,代码行数:8,代码来源:SimpleOutputEventListener.java

示例15: OutputMessageSerializer

import org.gradle.internal.logging.events.OutputEvent; //导入依赖的package包/类
public OutputMessageSerializer(Serializer<OutputEvent> eventSerializer) {
    this.eventSerializer = eventSerializer;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:DaemonMessageSerializer.java


注:本文中的org.gradle.internal.logging.events.OutputEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。