Skip to content

Commit

Permalink
Automatic code cleanup.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 414481809
  • Loading branch information
Googler authored and copybara-github committed Dec 6, 2021
1 parent d789eda commit 1987af2
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public AnalysisResult update(
"Analysis succeeded for only %d of %d top-level targets",
numSuccessful, numTargetsToAnalyze);
eventHandler.handle(Event.info(msg));
logger.atInfo().log(msg);
logger.atInfo().log("%s", msg);
}

AnalysisResult result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private void reportError(
// Don't hide unchecked exceptions as part of the error reporting.
Throwables.throwIfUnchecked(exception);

logger.atSevere().withCause(exception).log(msg);
logger.atSevere().withCause(exception).log("%s", msg);
reportCommandLineError(commandLineReporter, exception);
moduleEnvironment.exit(createAbruptExitException(exception, msg, besCode));
}
Expand Down Expand Up @@ -254,7 +254,7 @@ private void waitForPreviousInvocation(boolean isShutdown) {
+ "Cancelling and starting a new invocation...",
waitedMillis / 1000, waitedMillis % 1000);
reporter.handle(Event.warn(msg));
logger.atWarning().withCause(exception).log(msg);
logger.atWarning().withCause(exception).log("%s", msg);
cancelCloseFutures = true;
} catch (ExecutionException e) {
String msg;
Expand All @@ -274,7 +274,7 @@ private void waitForPreviousInvocation(boolean isShutdown) {
e.getMessage());
}
reporter.handle(Event.warn(msg));
logger.atWarning().withCause(e).log(msg);
logger.atWarning().withCause(e).log("%s", msg);
cancelCloseFutures = true;
} finally {
if (cancelCloseFutures) {
Expand Down Expand Up @@ -671,7 +671,7 @@ private BuildEventServiceTransport createBesTransport(
String.format(
"Build Event Service uploads disabled due to a connectivity problem: %s", status);
reporter.handle(Event.warn(message));
logger.atWarning().log(message);
logger.atWarning().log("%s", message);
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ ListenableFuture<Void> getHalfCloseFuture() {

private DetailedExitCode logAndSetException(
String message, BuildProgress.Code bpCode, Throwable cause) {
logger.atSevere().log(message);
logger.atSevere().log("%s", message);
DetailedExitCode detailedExitCode =
DetailedExitCode.of(
FailureDetail.newBuilder()
Expand Down Expand Up @@ -490,15 +490,15 @@ private void publishBuildEvents()
String.format(
"Expected ACK with seqNum=%d but received ACK with seqNum=%d",
expected.getSequenceNumber(), actualSeqNum);
logger.atInfo().log(message);
logger.atInfo().log("%s", message);
streamContext.abortStream(Status.FAILED_PRECONDITION.withDescription(message));
}
} else {
String message =
String.format(
"Received ACK (seqNum=%d) when no ACK was expected",
ackEvent.getSequenceNumber());
logger.atInfo().log(message);
logger.atInfo().log("%s", message);
streamContext.abortStream(Status.FAILED_PRECONDITION.withDescription(message));
}
}
Expand Down Expand Up @@ -537,7 +537,7 @@ private void publishBuildEvents()
if (!shouldRetryStatus(streamStatus)) {
String message =
String.format("Not retrying publishBuildEvents: status='%s'", streamStatus);
logger.atInfo().log(message);
logger.atInfo().log("%s", message);
throw withFailureDetail(
streamStatus.asException(),
BuildProgress.Code.BES_STREAM_NOT_RETRYING_FAILURE,
Expand All @@ -548,7 +548,7 @@ private void publishBuildEvents()
String.format(
"Not retrying publishBuildEvents, no more attempts left: status='%s'",
streamStatus);
logger.atInfo().log(message);
logger.atInfo().log("%s", message);
throw withFailureDetail(
streamStatus.asException(),
BuildProgress.Code.BES_UPLOAD_RETRY_LIMIT_EXCEEDED_FAILURE,
Expand Down Expand Up @@ -636,7 +636,7 @@ private void publishLifecycleEvent(PublishLifecycleEventRequest request)
if (!shouldRetryStatus(e.getStatus())) {
String message =
String.format("Not retrying publishLifecycleEvent: status='%s'", e.getStatus());
logger.atInfo().log(message);
logger.atInfo().log("%s", message);
throw withFailureDetail(e, BuildProgress.Code.BES_STREAM_NOT_RETRYING_FAILURE, message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private void exitFailure(Throwable e) {
.build()),
e));
pendingWrites.clear();
logger.atSevere().withCause(e).log(message);
logger.atSevere().withCause(e).log("%s", message);
}

private static BuildProgress.Code getBuildProgressCode(Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ private static void logDeleteTreeFailure(
for (Path entry : entries) {
directoryDetails.append(" '").append(entry.getBaseName()).append("'");
}
logger.atWarning().log(directoryDetails.toString());
logger.atWarning().log("%s", directoryDetails);
} catch (IOException e) {
logger.atWarning().withCause(e).log("'%s' exists but could not be read", directory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ private void stepLog(
Level level, @Nullable Throwable cause, @FormatString String fmt, Object... args) {
String msg = String.format(fmt, args);
String toLog = String.format("%s (#%d %s)", msg, id, desc());
logger.at(level).withCause(cause).log(toLog);
logger.at(level).withCause(cause).log("%s", toLog);
}

private String desc() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ public void afterCommand() throws AbruptExitException {
failure = e;
failureCode = Code.RPC_LOG_FAILURE;
failureMessage = "Partially wrote rpc log file";
logger.atWarning().withCause(e).log(failureMessage);
logger.atWarning().withCause(e).log("%s", failureMessage);
}

executorService = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ DetailedExitCode parseStarlarkOptions(CommandEnvironment env, ExtendedEventHandl
StarlarkOptionsParser.newStarlarkOptionsParser(env, optionsParser).parse(eventHandler);
} catch (OptionsParsingException e) {
String logMessage = "Error parsing Starlark options";
logger.atInfo().withCause(e).log(logMessage);
logger.atInfo().withCause(e).log("%s", logMessage);
return processOptionsParsingException(
eventHandler, e, logMessage, Code.STARLARK_OPTIONS_PARSE_FAILURE);
}
Expand Down Expand Up @@ -343,7 +343,7 @@ DetailedExitCode parseOptions(List<String> args, ExtendedEventHandler eventHandl
}
} catch (OptionsParsingException e) {
String logMessage = "Error parsing options";
logger.atInfo().withCause(e).log(logMessage);
logger.atInfo().withCause(e).log("%s", logMessage);
return processOptionsParsingException(
eventHandler, e, logMessage, Code.OPTIONS_PARSE_FAILURE);
} catch (InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ private static int batchMain(Iterable<BlazeModule> modules, String[] args) {

try {
logger.atInfo().log(
SafeRequestLogging.getRequestLogString(commandLineOptions.getOtherArgs()));
"%s", SafeRequestLogging.getRequestLogString(commandLineOptions.getOtherArgs()));
BlazeCommandResult result =
dispatcher.exec(
policy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void buildComplete(BuildCompleteEvent event) {
event.getResult().getBuildToolLogCollection()
.addDirectValue(
"critical path", criticalPath.toString().getBytes(StandardCharsets.UTF_8));
logger.atInfo().log(criticalPath.toString());
logger.atInfo().log("%s", criticalPath);
logger.atInfo().log(
"Slowest actions:\n %s",
Joiner.on("\n ").join(criticalPathComputer.getSlowestComponents()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ private void executeCommand(RunRequest request, BlockingStreamObserver<RunRespon
.collect(ImmutableList.toImmutableList());

InvocationPolicy policy = InvocationPolicyParser.parsePolicy(request.getInvocationPolicy());
logger.atInfo().log(SafeRequestLogging.getRequestLogString(args));
logger.atInfo().log("%s", SafeRequestLogging.getRequestLogString(args));
result =
dispatcher.exec(
policy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ private static void printStack(IOException e) {
printErr.println("=======[BAZEL SERVER: ENCOUNTERED IO EXCEPTION]=======");
e.printStackTrace(printErr);
printErr.println("=====================================================");
logger.atSevere().log(err.toString());
logger.atSevere().log("%s", err);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public int available() {
}

private static void processInput(InputStream stdinInput, Subprocess process) {
logger.atFiner().log(stdinInput.toString());
logger.atFiner().log("%s", stdinInput);
try (OutputStream out = process.getOutputStream()) {
ByteStreams.copy(stdinInput, out);
} catch (IOException ioe) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ private static void logDiffInfo(
}
}

logger.atInfo().log(result.toString());
logger.atInfo().log("%s", result);
}

private static int getNumberOfModifiedFiles(Iterable<SkyKey> modifiedValues) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ static final class VacuousSuccess extends Statement {

@Override
public void evaluate() throws Throwable {
logger.atWarning().log(reason);
logger.atWarning().log("%s", reason);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ private ActionResult execute(
String.format(
"Command:\n%s\nexceeded deadline of %f seconds.",
Arrays.toString(command.getArgumentsList().toArray()), timeoutMillis / 1000.0);
logger.atWarning().log(errMessage);
logger.atWarning().log("%s", errMessage);
errStatus =
Status.newBuilder()
.setCode(Code.DEADLINE_EXCEEDED.getNumber())
Expand Down

0 comments on commit 1987af2

Please sign in to comment.