Migrate server classes to Flogger
This is the second part of the migration to Flogger. This change migrates all classes of the 'server' module to Flogger. Classes of the 'httpd' module have been migrated by the predecessor change. Other modules continue to use slf4j. They should be migrated by follow-up changes. During this migration we try to make the log statements more consistent: - avoid string concatenation - avoid usage of String.format(...) Change-Id: I233afc8360af7fef8640394204d0d676cc0d0001 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -28,6 +28,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.google.gerrit.common.Nullable;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
@@ -70,11 +71,11 @@ import org.eclipse.jgit.lib.RefUpdate;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.revwalk.RevWalk;
|
||||
import org.eclipse.jgit.transport.ReceiveCommand;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class StarredChangesUtil {
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
@AutoValue
|
||||
public abstract static class StarField {
|
||||
private static final String SEPARATOR = ":";
|
||||
@@ -154,8 +155,6 @@ public class StarredChangesUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(StarredChangesUtil.class);
|
||||
|
||||
public static final String DEFAULT_LABEL = "star";
|
||||
public static final String IGNORE_LABEL = "ignore";
|
||||
public static final String REVIEWED_LABEL = "reviewed";
|
||||
@@ -305,11 +304,12 @@ public class StarredChangesUtil {
|
||||
Ref ref = repo.exactRef(RefNames.refsStarredChanges(changeId, accountId));
|
||||
return ref != null ? ref.getObjectId() : ObjectId.zeroId();
|
||||
} catch (IOException e) {
|
||||
log.error(
|
||||
String.format(
|
||||
logger
|
||||
.atSevere()
|
||||
.withCause(e)
|
||||
.log(
|
||||
"Getting star object ID for account %d on change %d failed",
|
||||
accountId.get(), changeId.get()),
|
||||
e);
|
||||
accountId.get(), changeId.get());
|
||||
return ObjectId.zeroId();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user