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

@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import com.google.common.net.InternetDomainName;
import com.google.common.util.concurrent.RateLimiter;
import google.registry.config.RegistryConfig.Config;
@ -91,7 +91,7 @@ public class MultiplyingCloudDnsWriter extends BaseDnsWriter {
*/
public static final String NAME = "MultiplyingCloudDnsWriter";
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
private static final ImmutableSet<String> RETRYABLE_EXCEPTION_REASONS =
ImmutableSet.of("preconditionFailed", "notFound", "alreadyExists");
@ -199,13 +199,13 @@ public class MultiplyingCloudDnsWriter extends BaseDnsWriter {
}
desiredRecords.put(absoluteDomainName, domainRecords.build());
logger.finefmt(
"Will write %s records for domain %s", domainRecords.build().size(), absoluteDomainName);
logger.atFine().log(
"Will write %d records for domain %s", domainRecords.build().size(), absoluteDomainName);
}
}
private void publishSubordinateHost(String hostName) {
logger.infofmt("Publishing glue records for %s", hostName);
logger.atInfo().log("Publishing glue records for %s", hostName);
// Canonicalize name
String absoluteHostName = getAbsoluteHostName(hostName);
@ -272,7 +272,7 @@ public class MultiplyingCloudDnsWriter extends BaseDnsWriter {
// Host not managed by our registry, no need to update DNS.
if (!tld.isPresent()) {
logger.severefmt("publishHost called for invalid host %s", hostName);
logger.atSevere().log("publishHost called for invalid host %s", hostName);
return;
}
@ -303,7 +303,7 @@ public class MultiplyingCloudDnsWriter extends BaseDnsWriter {
ImmutableMap<String, ImmutableSet<ResourceRecordSet>> desiredRecordsCopy =
ImmutableMap.copyOf(desiredRecords);
retrier.callWithRetry(() -> mutateZone(desiredRecordsCopy), ZoneStateException.class);
logger.info("Wrote to Cloud DNS");
logger.atInfo().log("Wrote to Cloud DNS");
}
/**
@ -357,7 +357,7 @@ public class MultiplyingCloudDnsWriter extends BaseDnsWriter {
*/
private Map<String, List<ResourceRecordSet>> getResourceRecordsForDomains(
Set<String> domainNames) {
logger.finefmt("Fetching records for %s", domainNames);
logger.atFine().log("Fetching records for %s", domainNames);
// As per Concurrent.transform() - if numThreads or domainNames.size() < 2, it will not use
// threading.
return ImmutableMap.copyOf(
@ -406,12 +406,12 @@ public class MultiplyingCloudDnsWriter extends BaseDnsWriter {
// the result.
ImmutableSet<ResourceRecordSet> intersection =
Sets.intersection(additions, deletions).immutableCopy();
logger.infofmt(
"There are %s common items out of the %s items in 'additions' and %s items in 'deletions'",
logger.atInfo().log(
"There are %d common items out of the %d items in 'additions' and %d items in 'deletions'",
intersection.size(), additions.size(), deletions.size());
// Exit early if we have nothing to update - dnsConnection doesn't work on empty changes
if (additions.equals(deletions)) {
logger.infofmt("Returning early because additions is the same as deletions");
logger.atInfo().log("Returning early because additions is the same as deletions");
return;
}
Change change =