This matches the behavior of the hooks in UploadPack.
Change-Id: I21277e52ee9452237d87084f06bb140dfa6bf608
private PackWriter.Statistics statistics;
- private UploadPackLogger logger;
+ private UploadPackLogger logger = UploadPackLogger.NULL;
/**
* Create a new pack upload for an open repository.
this.packConfig = pc;
}
+ /** @return the configured logger. */
+ public UploadPackLogger getLogger() {
+ return logger;
+ }
+
/**
* Set the logger.
*
if (sideband)
pckOut.end();
- if (logger != null && statistics != null)
+ if (statistics != null)
logger.onPackStatistics(statistics);
}
}
* 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.
*