lib/adapters/file.js
function _createRotatedLogName(logPath, modifiedDate){
    var logName = logPath,
        suffixIdx = logPath.lastIndexOf('.'),
        suffix = '';

    if(suffixIdx > -1){
        suffix = logName.substr(suffixIdx, logName.length);
        logName = logName.replace(
            suffix, ('.' +
                modifiedDate.getFullYear() +
                '-' + (modifiedDate.getMonth() + 1) +
                '-' + modifiedDate.getDate()
                ) + suffix
            );
    }
    else {
        logName = logName +
            ('.' + modifiedDate.getFullYear() + '-' + (modifiedDate.getMonth() + 1) + '-' + modifiedDate.getDate());
    }

    return logName;
}
function _createRotatedLogName(logPath, modifiedDate){
    var logName = logPath,
        suffixIdx = logPath.lastIndexOf('.'),
        suffix = '';

    if(suffixIdx > -1){
        suffix = logName.substr(suffixIdx, logName.length);
        logName = logName.replace(
            suffix, ('.' +
                modifiedDate.getFullYear() +
                '-' + (modifiedDate.getMonth() + 1) +
                '-' + modifiedDate.getDate()
                ) + suffix
            );
    }
    else {
        logName = logName +
            ('.' + modifiedDate.getFullYear() + '-' + (modifiedDate.getMonth() + 1) + '-' + modifiedDate.getDate());
    }

    return logName;
}
function _createRotatedLogName ( logPath , modifiedDate ) { var logName = logPath , suffixIdx = logPath . lastIndexOf ( '.' ) , suffix = '' ; if ( suffixIdx > - 1 ) { suffix = logName . substr ( suffixIdx , logName . length ) ; logName = logName . replace ( suffix , ( '.' + modifiedDate . getFullYear ( ) + '-' + ( modifiedDate . getMonth ( ) + 1 ) + '-' + modifiedDate . getDate ( ) ) + suffix ) ; } else { logName = logName + ( '.' + modifiedDate . getFullYear ( ) + '-' + ( modifiedDate . getMonth ( ) + 1 ) + '-' + modifiedDate . getDate ( ) ) ; } return logName ; }
Method that will take the passed in logPath and recreate the path with a modified file name. So if a file
was modified on a previous day and a new log is coming in on the current day, then we want to rename the
old log file with the date in the name.
@param logPath Path of current log file
@param modifiedDate Last file modified date
@returns {string} New file path for previous log
Method that will take the passed in logPath and recreate the path with a modified file name . So if a file was modified on a previous day and a new log is coming in on the current day then we want to rename the old log file with the date in the name .