Migrate to Flogger (green)

This is a 'green' Flogger migration CL. Green CLs are intended to be as
safe as possible and should be easy to review and submit.

No changes should be necessary to the code itself prior to submission,
but small changes to BUILD files may be required.

Changes within files are completely independent of each other, so this CL
can be safely split up for review using tools such as Rosie.

For more information, see []
Base CL: 197826149

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198560170
This commit is contained in:
jianglai 2018-05-30 07:58:51 -07:00
parent 0d2fb3a8f0
commit 70b13596e4
178 changed files with 984 additions and 988 deletions

View file

@ -17,7 +17,7 @@ package google.registry.util;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@ -43,7 +43,7 @@ import javax.annotation.concurrent.NotThreadSafe;
@NotThreadSafe
public class ImprovedOutputStream extends FilterOutputStream {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
private long count;
private final long expected;
@ -103,9 +103,9 @@ public class ImprovedOutputStream extends FilterOutputStream {
try {
flush();
} catch (IOException e) {
logger.warningfmt(e, "%s.flush() failed", getClass().getSimpleName());
logger.atWarning().withCause(e).log("%s.flush() failed", getClass().getSimpleName());
}
logger.infofmt("%s closed with %,d bytes written", getClass().getSimpleName(), count);
logger.atInfo().log("%s closed with %,d bytes written", getClass().getSimpleName(), count);
if (expected != -1 && count != expected) {
throw new IOException(String.format(
"%s expected %,d bytes but got %,d bytes", getClass().getSimpleName(), expected, count));