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);
  };
}
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);
  };
}
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 ) ; } ; }
Generates a function that will perform logic required
to update a log file with a new log entry.
@param  {Log} log [description]
Generates a function that will perform logic required to update a log file with a new log entry .