Search in sources :

Example 1 with StyledTextOutputEventSerializer

use of org.gradle.internal.logging.serializer.StyledTextOutputEventSerializer in project gradle by gradle.

the class DaemonMessageSerializer method create.

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);
}
Also used : LogLevelChangeEventSerializer(org.gradle.internal.logging.serializer.LogLevelChangeEventSerializer) ListSerializer(org.gradle.internal.serialize.ListSerializer) SpanSerializer(org.gradle.internal.logging.serializer.SpanSerializer) DefaultSerializerRegistry(org.gradle.internal.serialize.DefaultSerializerRegistry) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput) ProgressEventSerializer(org.gradle.internal.logging.serializer.ProgressEventSerializer) ProgressCompleteEventSerializer(org.gradle.internal.logging.serializer.ProgressCompleteEventSerializer) LogLevel(org.gradle.api.logging.LogLevel) LogEventSerializer(org.gradle.internal.logging.serializer.LogEventSerializer) BaseSerializerFactory(org.gradle.internal.serialize.BaseSerializerFactory) StyledTextOutputEventSerializer(org.gradle.internal.logging.serializer.StyledTextOutputEventSerializer) StyledTextOutputEvent(org.gradle.internal.logging.events.StyledTextOutputEvent)

Example 2 with StyledTextOutputEventSerializer

use of org.gradle.internal.logging.serializer.StyledTextOutputEventSerializer in project gradle by gradle.

the class WorkerLoggingSerializer method create.

public static SerializerRegistry create() {
    DefaultSerializerRegistry registry = new DefaultSerializerRegistry(false);
    BaseSerializerFactory factory = new BaseSerializerFactory();
    Serializer<LogLevel> logLevelSerializer = factory.getSerializerFor(LogLevel.class);
    Serializer<Throwable> throwableSerializer = factory.getSerializerFor(Throwable.class);
    // Log 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(LogLevelChangeEvent.class, new LogLevelChangeEventSerializer(logLevelSerializer));
    return registry;
}
Also used : LogLevelChangeEventSerializer(org.gradle.internal.logging.serializer.LogLevelChangeEventSerializer) ListSerializer(org.gradle.internal.serialize.ListSerializer) SpanSerializer(org.gradle.internal.logging.serializer.SpanSerializer) DefaultSerializerRegistry(org.gradle.internal.serialize.DefaultSerializerRegistry) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput) LogLevel(org.gradle.api.logging.LogLevel) LogEventSerializer(org.gradle.internal.logging.serializer.LogEventSerializer) BaseSerializerFactory(org.gradle.internal.serialize.BaseSerializerFactory) StyledTextOutputEventSerializer(org.gradle.internal.logging.serializer.StyledTextOutputEventSerializer) StyledTextOutputEvent(org.gradle.internal.logging.events.StyledTextOutputEvent)

Aggregations

LogLevel (org.gradle.api.logging.LogLevel)2 StyledTextOutputEvent (org.gradle.internal.logging.events.StyledTextOutputEvent)2 LogEventSerializer (org.gradle.internal.logging.serializer.LogEventSerializer)2 LogLevelChangeEventSerializer (org.gradle.internal.logging.serializer.LogLevelChangeEventSerializer)2 SpanSerializer (org.gradle.internal.logging.serializer.SpanSerializer)2 StyledTextOutputEventSerializer (org.gradle.internal.logging.serializer.StyledTextOutputEventSerializer)2 StyledTextOutput (org.gradle.internal.logging.text.StyledTextOutput)2 BaseSerializerFactory (org.gradle.internal.serialize.BaseSerializerFactory)2 DefaultSerializerRegistry (org.gradle.internal.serialize.DefaultSerializerRegistry)2 ListSerializer (org.gradle.internal.serialize.ListSerializer)2 ProgressCompleteEventSerializer (org.gradle.internal.logging.serializer.ProgressCompleteEventSerializer)1 ProgressEventSerializer (org.gradle.internal.logging.serializer.ProgressEventSerializer)1