use of org.gradle.internal.logging.events.LogLevelChangeEvent in project gradle by gradle.
the class OutputEventRenderer method onOutput.
@Override
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);
}
}
use of org.gradle.internal.logging.events.LogLevelChangeEvent in project gradle by gradle.
the class StyledTextOutputBackedRenderer method onOutput.
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);
}
}
use of org.gradle.internal.logging.events.LogLevelChangeEvent in project gradle by gradle.
the class PrintStreamLoggingSystem method install.
private void install() {
if (original == null) {
PrintStream originalStream = get();
original = new PrintStreamDestination(originalStream);
}
enabled = true;
outstr.flush();
outputEventListener.onOutput(new LogLevelChangeEvent(logLevel));
destination.set(listener);
if (get() != outstr) {
set(outstr);
}
}
use of org.gradle.internal.logging.events.LogLevelChangeEvent in project gradle by gradle.
the class PrintStreamLoggingSystem method setLevel.
@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;
}
use of org.gradle.internal.logging.events.LogLevelChangeEvent in project gradle by gradle.
the class OutputEventRenderer method addConsole.
public OutputEventRenderer addConsole(Console console, boolean stdout, boolean stderr, ConsoleMetaData consoleMetaData) {
final OutputEventListener consoleChain = new ThrottlingOutputEventListener(new BuildStatusRenderer(new WorkInProgressRenderer(new ProgressLogEventGenerator(new StyledTextOutputBackedRenderer(console.getBuildOutputArea()), true), console.getBuildProgressArea(), new DefaultWorkInProgressFormatter(consoleMetaData)), console.getStatusBar(), console, consoleMetaData), new TrueTimeProvider());
synchronized (lock) {
if (stdout && stderr) {
this.console = consoleChain;
removeStandardOutputListener();
removeStandardErrorListener();
} else if (stdout) {
this.console = onNonError(consoleChain);
removeStandardOutputListener();
} else {
this.console = onError(consoleChain);
removeStandardErrorListener();
}
consoleChain.onOutput(new LogLevelChangeEvent(logLevel));
formatters.add(this.console);
}
return this;
}
Aggregations