use of org.gradle.internal.logging.events.LogEvent in project gradle by gradle.
the class LogEventSerializer method read.
@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);
}
use of org.gradle.internal.logging.events.LogEvent in project gradle by gradle.
the class OutputEventListenerBackedLogger method log.
private void log(LogLevel logLevel, Throwable throwable, String message) {
LogEvent logEvent = new LogEvent(timeProvider.getCurrentTime(), name, logLevel, message, throwable);
OutputEventListener outputEventListener = context.getOutputEventListener();
try {
outputEventListener.onOutput(logEvent);
} catch (Throwable e) {
// fall back to standard out
e.printStackTrace(System.out);
}
}
use of org.gradle.internal.logging.events.LogEvent in project gradle by gradle.
the class LoggingTest method expectLogMessage.
private void expectLogMessage(final LogLevel level, final String text) {
final Matcher<LogEvent> matcher = new BaseMatcher<LogEvent>() {
public void describeTo(Description description) {
description.appendText("level: ").appendValue(level).appendText(", text:").appendValue(text);
}
public boolean matches(Object o) {
LogEvent event = (LogEvent) o;
return event.getLogLevel() == level && event.getMessage().equals(text);
}
};
context.checking(new Expectations() {
{
one(outputEventListener).onOutput(with(matcher));
}
});
}
Aggregations