Use Flogger for writing logs
Using Flogger for logging is consistent with Gerrit core. Also Flogger
has a fluent API that is less error-prone and easier to read.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I606a7f39a7969dcacb5dbf4dc195c088629c311a
diff --git a/java/com/googlesource/gerrit/plugins/supermanifest/JiriUpdater.java b/java/com/googlesource/gerrit/plugins/supermanifest/JiriUpdater.java
index 83a2eb7..129ae35 100644
--- a/java/com/googlesource/gerrit/plugins/supermanifest/JiriUpdater.java
+++ b/java/com/googlesource/gerrit/plugins/supermanifest/JiriUpdater.java
@@ -5,6 +5,7 @@
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.collect.Lists;
+import com.google.common.flogger.FluentLogger;
import com.google.gerrit.extensions.config.DownloadScheme;
import com.google.gerrit.server.plugincontext.PluginMapContext;
import com.googlesource.gerrit.plugins.supermanifest.SuperManifestRefUpdatedListener.GerritRemoteReader;
@@ -34,8 +35,6 @@
import org.eclipse.jgit.lib.RefUpdate.Result;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevWalk;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
class JiriUpdater implements SubModuleUpdater {
PersonIdent serverIdent;
@@ -51,12 +50,12 @@
this.downloadScheme = downloadScheme;
}
- private static final Logger log = LoggerFactory.getLogger(SuperManifestRefUpdatedListener.class);
+ private static final FluentLogger logger = FluentLogger.forEnclosingClass();
private void warn(String formatStr, Object... args) {
// The docs claim that log.warn() uses format strings, but it doesn't seem to work, so we do it
// explicitly.
- log.warn(canonicalWebUrl + " : " + String.format(formatStr, args));
+ logger.atWarning().log("%s : %s", canonicalWebUrl, String.format(formatStr, args));
}
private void updateSubmodules(