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

@ -19,7 +19,7 @@ import static com.google.common.collect.Iterables.toArray;
import com.google.common.base.Joiner;
import com.google.common.collect.Streams;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import google.registry.config.RegistryConfig.Config;
import google.registry.util.NonFinalForTesting;
import google.registry.util.SendEmailService;
@ -35,7 +35,7 @@ import javax.mail.internet.InternetAddress;
*/
public class SendEmailUtils {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
private final String gSuiteOutgoingEmailAddress;
private final String gSuiteOutoingEmailDisplayName;
@ -67,11 +67,8 @@ public class SendEmailUtils {
try {
return new InternetAddress(emailAddress, true);
} catch (AddressException e) {
logger.severefmt(
e,
"Could not send email to %s with subject '%s'.",
emailAddress,
subject);
logger.atSevere().withCause(e).log(
"Could not send email to %s with subject '%s'.", emailAddress, subject);
// Returning null excludes this address from the list of recipients on the
// email.
return null;
@ -87,11 +84,9 @@ public class SendEmailUtils {
msg.setText(body);
emailService.sendMessage(msg);
} catch (Throwable t) {
logger.severefmt(
t,
logger.atSevere().withCause(t).log(
"Could not email to addresses %s with subject '%s'.",
Joiner.on(", ").join(addresses),
subject);
Joiner.on(", ").join(addresses), subject);
return false;
}
return true;