Generates a function that will perform logic required
to update a log file with a new log entry.
@param  {Log} log [description]
function getWriteFunction(log) {
  return function writeLogFile (name, qcb) {
    var dir = path.join(LOG_DIR, name);

    function readFile (cb) {
      fs.readFile(dir, cb);
    }

    function updateLogs (logs, cb) {
      logs.push(log.toJSON());
      cb(null, logs);
    }

    function writeFile (str, cb) {
      fs.writeFile(dir, str, cb);
    }

    async.waterfall([
      readFile,
      safejson.parse,
      updateLogs,
      safejson.stringify,
      writeFile
    ], qcb);
  };
}