function getMostRecentFilename (callback) {
  getLogFiles(function (err, files) {
    if (err) {
      callback(err, null);
    } else if (!files || files.length === 0) {
      return callback(null, Date.now().toString().concat(FILE_EXT));
    } else {
      var file = _.max(files, function (f) {
        var n = (f && typeof f.name === 'string') ? f.name : f;

        // Remove extension to get just the timestamp
        var ts = n.replace(FILE_EXT, '');

        return parseInt(ts, 10);
      });

      var n = (file && typeof file.name === 'string') ? file.name : file;

      callback(null, n);
    }
  });
}
function getMostRecentFilename (callback) {
  getLogFiles(function (err, files) {
    if (err) {
      callback(err, null);
    } else if (!files || files.length === 0) {
      return callback(null, Date.now().toString().concat(FILE_EXT));
    } else {
      var file = _.max(files, function (f) {
        var n = (f && typeof f.name === 'string') ? f.name : f;

        
        var ts = n.replace(FILE_EXT, '');

        return parseInt(ts, 10);
      });

      var n = (file && typeof file.name === 'string') ? file.name : file;

      callback(null, n);
    }
  });
}
function getMostRecentFilename ( callback ) { getLogFiles ( function ( err , files ) { if ( err ) { callback ( err , null ) ; } else if ( ! files || files . length === 0 ) { return callback ( null , Date . now ( ) . toString ( ) . concat ( FILE_EXT ) ) ; } else { var file = _ . max ( files , function ( f ) { var n = ( f && typeof f . name === 'string' ) ? f . name : f ; // Remove extension to get just the timestamp var ts = n . replace ( FILE_EXT , '' ) ; return parseInt ( ts , 10 ) ; } ) ; var n = ( file && typeof file . name === 'string' ) ? file . name : file ; callback ( null , n ) ; } } ) ; }
Get the name of the most recent log file
@param  {Array}    files
@param  {Function} callback
Get the name of the most recent log file