use of com.facebook.buck.event.listener.LoggingBuildListener in project buck by facebook.
the class Main method addEventListeners.
@SuppressWarnings("PMD.PrematureDeclaration")
private ImmutableList<BuckEventListener> addEventListeners(BuckEventBus buckEventBus, ProjectFilesystem projectFilesystem, InvocationInfo invocationInfo, BuckConfig buckConfig, Optional<WebServer> webServer, Clock clock, AbstractConsoleEventBusListener consoleEventBusListener, Supplier<BuckEventListener> missingSymbolsListenerSupplier, CounterRegistry counterRegistry, Iterable<BuckEventListener> commandSpecificEventListeners) {
ImmutableList.Builder<BuckEventListener> eventListenersBuilder = ImmutableList.<BuckEventListener>builder().add(new JavaUtilsLoggingBuildListener()).add(consoleEventBusListener).add(new LoggingBuildListener());
if (buckConfig.isChromeTraceCreationEnabled()) {
try {
eventListenersBuilder.add(new ChromeTraceBuildListener(projectFilesystem, invocationInfo, clock, objectMapper, buckConfig.getMaxTraces(), buckConfig.getCompressTraces()));
} catch (IOException e) {
LOG.error("Unable to create ChromeTrace listener!");
}
} else {
LOG.warn("::: ChromeTrace listener disabled");
}
if (webServer.isPresent()) {
eventListenersBuilder.add(webServer.get().createListener());
}
loadListenersFromBuckConfig(eventListenersBuilder, projectFilesystem, buckConfig);
if (buckConfig.isRuleKeyLoggerEnabled()) {
eventListenersBuilder.add(new RuleKeyLoggerListener(projectFilesystem, invocationInfo, MostExecutors.newSingleThreadExecutor(new CommandThreadFactory(getClass().getName()))));
}
if (buckConfig.isMachineReadableLoggerEnabled()) {
try {
eventListenersBuilder.add(new MachineReadableLoggerListener(invocationInfo, projectFilesystem, MostExecutors.newSingleThreadExecutor(new CommandThreadFactory(getClass().getName()))));
} catch (FileNotFoundException e) {
LOG.warn("Unable to open stream for machine readable log file.");
}
}
JavaBuckConfig javaBuckConfig = buckConfig.getView(JavaBuckConfig.class);
if (!javaBuckConfig.getSkipCheckingMissingDeps()) {
eventListenersBuilder.add(missingSymbolsListenerSupplier.get());
}
eventListenersBuilder.add(new LoadBalancerEventsListener(counterRegistry));
eventListenersBuilder.add(new CacheRateStatsListener(buckEventBus));
eventListenersBuilder.add(new WatchmanDiagnosticEventListener(buckEventBus));
eventListenersBuilder.addAll(commandSpecificEventListeners);
ImmutableList<BuckEventListener> eventListeners = eventListenersBuilder.build();
eventListeners.forEach(buckEventBus::register);
return eventListeners;
}
Aggregations