diff --git a/Command/ProgressClosureBuilder.php b/Command/ProgressClosureBuilder.php
index b918511..53bcb18 100644
--- a/Command/ProgressClosureBuilder.php
+++ b/Command/ProgressClosureBuilder.php
@@ -35,12 +35,18 @@ class ProgressClosureBuilder
$progress = null;
- return function ($increment, $totalObjects) use (&$progress, $output, $action, $index, $type) {
+ return function ($increment, $totalObjects, $message = null) use (&$progress, $output, $action, $index, $type) {
if (null === $progress) {
$progress = new ProgressBar($output, $totalObjects);
$progress->start();
}
+ if (null !== $message) {
+ $progress->clear();
+ $output->writeln(sprintf('%s %s', $action, $message));
+ $progress->display();
+ }
+
$progress->setMessage(sprintf('%s %s/%s', $action, $index, $type));
$progress->advance($increment);
};
@@ -62,11 +68,15 @@ class ProgressClosureBuilder
$lastStep = null;
$current = 0;
- return function ($increment, $totalObjects) use ($output, $action, $index, $type, &$lastStep, &$current) {
+ return function ($increment, $totalObjects, $message = null) use ($output, $action, $index, $type, &$lastStep, &$current) {
if ($current + $increment > $totalObjects) {
$increment = $totalObjects - $current;
}
+ if (null !== $message) {
+ $output->writeln(sprintf('%s %s', $action, $message));
+ }
+
$currentTime = microtime(true);
$timeDifference = $currentTime - $lastStep;
$objectsPerSecond = $lastStep ? ($increment / $timeDifference) : $increment;
diff --git a/Doctrine/AbstractProvider.php b/Doctrine/AbstractProvider.php
index 80d0716..2d5d264 100644
--- a/Doctrine/AbstractProvider.php
+++ b/Doctrine/AbstractProvider.php
@@ -67,7 +67,7 @@ abstract class AbstractProvider extends BaseAbstractProvider
$this->objectPersister->insertMany($objects);
} catch(BulkResponseException $e) {
if ($loggerClosure) {
- $loggerClosure(sprintf('%s',$e->getMessage()));
+ $loggerClosure($batchSize, $nbObjects, sprintf('%s', $e->getMessage()));
}
}
}
diff --git a/Provider/ProviderInterface.php b/Provider/ProviderInterface.php
index e8d7ea4..188f2a1 100644
--- a/Provider/ProviderInterface.php
+++ b/Provider/ProviderInterface.php
@@ -12,6 +12,11 @@ interface ProviderInterface
/**
* Persists all domain objects to ElasticSearch for this provider.
*
+ * The closure can expect 2 or 3 arguments:
+ * * The step size
+ * * The total number of objects
+ * * A message to output in error conditions (not normally provided)
+ *
* @param \Closure $loggerClosure
* @param array $options
* @return