'use strict';

var upload = require('./helpers/upload.js');

module.exports.addition = function additionQueueWorker(job, cb) {
  console.log("UPLOADING", job.task.identifier);
  upload(job.serviceData.instanceUrl, job.task, job.anyfetchClient, cb);
};

module.exports.deletion = function deletionQueueWorker(job, cb) {
  console.log("DELETING", job.task.identifier);
  job.anyfetchClient.deleteDocumentByIdentifier(job.task.identifier, function(err) {
    if(err && err.toString().match(/expected 204 "No Content", got 404 "Not Found"/i)) {
      err = null;
    }

    cb(err);
  });
};

@@ -8,16 +8,61 @@
 rict';%0A%0A
+var log = require('anyfetch-provider').log;%0A%0A
 var uplo
@@ -171,32 +171,56 @@
 %7B%0A  
-console.log(%22UPLOADING%22,
+log.info(%7B%0A    name: 'addition',%0A    identifier:
  job
@@ -231,24 +231,41 @@
 k.identifier
+%0A  %7D, %22Uploading%22
 );%0A  upload(
@@ -404,31 +404,56 @@
 %7B%0A  
-console.log(%22DELETING%22,
+log.info(%7B%0A    name: 'deletion',%0A    identifier:
  job
@@ -468,16 +468,32 @@
 entifier
+%0A  %7D, %22Deleting%22
 );%0A  job

Update logging