diff options
author | Shawn Pearce <spearce@spearce.org> | 2011-12-08 21:44:18 -0500 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2011-12-08 21:44:18 -0500 |
commit | 1291e834df27237cb3769d7d54d93edc0c6ecfbf (patch) | |
tree | c3dd96236a4603b253d9ea6dac878c6bda81c747 | |
parent | 4e92ae1656a3cfb6d202706889afe652f2c90bb8 (diff) | |
parent | d6172dc0de2cbaeb0bd38a9d30278dd5f9b140b3 (diff) | |
download | jgit-1291e834df27237cb3769d7d54d93edc0c6ecfbf.tar.gz jgit-1291e834df27237cb3769d7d54d93edc0c6ecfbf.zip |
Merge "Add a no-op UploadPackLogger and use it by default"
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java | 9 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java | 7 |
2 files changed, 14 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index ca3d24790c..2fa6e5cff0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -217,7 +217,7 @@ public class UploadPack { private PackWriter.Statistics statistics; - private UploadPackLogger logger; + private UploadPackLogger logger = UploadPackLogger.NULL; /** * Create a new pack upload for an open repository. @@ -376,6 +376,11 @@ public class UploadPack { this.packConfig = pc; } + /** @return the configured logger. */ + public UploadPackLogger getLogger() { + return logger; + } + /** * Set the logger. * @@ -1111,7 +1116,7 @@ public class UploadPack { if (sideband) pckOut.end(); - if (logger != null && statistics != null) + if (statistics != null) logger.onPackStatistics(statistics); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java index 6e37b837b8..45f91ed81c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java @@ -54,6 +54,13 @@ import org.eclipse.jgit.storage.pack.PackWriter; * the connection information before invoking UploadPack. */ public interface UploadPackLogger { + /** A simple no-op logger. */ + public static final UploadPackLogger NULL = new UploadPackLogger() { + public void onPackStatistics(PackWriter.Statistics stats) { + // Do nothing. + } + }; + /** * Notice to the logger after a pack has been sent. * |