Browse Source

Merge "Add a no-op UploadPackLogger and use it by default"

stable-1.3
Shawn Pearce 13 years ago committed by Code Review
parent
commit
1291e834df
  1. 9
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
  2. 7
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPackLogger.java

9
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);
}
}

7
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.
*

Loading…
Cancel
Save