lib/adapters/file.js
function ensureLogsRotated(stats){
    // TODO: other writes should wait until this is done
    var today = new Date(),
        modifiedDate = new Date(stats.mtime),
        archivedFileName;

    if(!_logDatesMatch(today, modifiedDate)){
        archivedFileName = _createRotatedLogName(this.config.path, modifiedDate);
        console.log('Log file modified previous to today, archiving to: ' + archivedFileName);

        return fs.renameAsync(this.config.path, archivedFileName)
            .bind(this)
            .then(this.createEmptyFile);
    }
}
function ensureLogsRotated(stats){
    // TODO: other writes should wait until this is done
    var today = new Date(),
        modifiedDate = new Date(stats.mtime),
        archivedFileName;

    if(!_logDatesMatch(today, modifiedDate)){
        archivedFileName = _createRotatedLogName(this.config.path, modifiedDate);
        console.log('Log file modified previous to today, archiving to: ' + archivedFileName);

        return fs.renameAsync(this.config.path, archivedFileName)
            .bind(this)
            .then(this.createEmptyFile);
    }
}
function ensureLogsRotated ( stats ) { // TODO: other writes should wait until this is done var today = new Date ( ) , modifiedDate = new Date ( stats . mtime ) , archivedFileName ; if ( ! _logDatesMatch ( today , modifiedDate ) ) { archivedFileName = _createRotatedLogName ( this . config . path , modifiedDate ) ; console . log ( 'Log file modified previous to today, archiving to: ' + archivedFileName ) ; return fs . renameAsync ( this . config . path , archivedFileName ) . bind ( this ) . then ( this . createEmptyFile ) ; } }
Method will look at the stats of a file and if it was modified on a date that was not today then it will
rename it to it's modfied date so we can start fresh daily.
@param stats Stats of a file
@returns {string} Status of rotation ('datematches' - do nothing, 'logrotated' - change detected rename file)
Method will look at the stats of a file and if it was modified on a date that was not today then it will rename it to it s modfied date so we can start fresh daily .