nl_tokens: Determine the file to write the current log file to
pl_tokens: function getRequiredFilename ( name , <mask> ) { var filepath = path . join ( LOG_DIR , name ) ; function getStats ( ) { fs . stat ( filepath , function ( err , stats ) { if ( err ) { callback ( err , null ) ; } else if ( stats && stats . size >= MAX_FILE_SIZE ) { createFile ( ) ; } else { callback ( null , name ) ; } } ) ; } function createFile ( ) { fs . writeFile ( filepath , '[]' , function ( err ) { if ( err ) { callback ( err , null ) ; } else { callback ( null , name ) ; } } ) ; } fs . exists ( filepath , function ( exists ) { if ( exists ) { getStats ( ) ; } else { createFile ( ) ; } } ) ; }