Permalink
Browse files

- Documented: use of logger in README

  • Loading branch information...
1 parent 0ae0272 commit 956b8431a007cb1c0c9df73377ca0adbb62a2eaf @kore committed May 13, 2010
Showing with 29 additions and 0 deletions.
  1. +29 −0 README.rst
View
@@ -45,6 +45,35 @@ The ``4`` (second parameter of ``\njq\Executor::run``) defines the number of
parallel processes to spawn. This should not exceed the number of available
cores in the most cases.
+Logger
+======
+
+To view the state of the executor you can specify a logger, which then can echo
+the current progress. A logger needs to implement the ``\njq\Logger`` interface
+and is passed to the constructor of the executor. If no logger is specified a
+blind dummy logger will be used. To use the shell logger, echoing the state to
+STDERR, use::
+
+ <?php
+
+ require 'njq/environment.php';
+
+ $executor = new \njq\Executor( new \njq\ShellLogger() );
+ $executor->run(
+ new \njq\ShellJobProvider( array(
+ // ...
+ ) ),
+ 4
+ );
+
+It will then print a status like the following, if the ``JobProvider``
+implements the ``Countable`` interface::
+
+ 56 / 5880 (0.95%) |
+
+If the ``JobProvider`` does not implement the ``Countable`` interface the
+percent indicator obviously cannot be displayed.
+
Requirements
============

0 comments on commit 956b843

Please sign in to comment.