Add err_retry and err_stop as optional arguments to replicate

The pmap function has two optional arguments that specify error
handling. replicate has been using the default values of those
arguments, but this commit allows them to be set when calling
replicate. They are still optional arguments and default to the
old behavior.
Add initial logging code