src/utils/HealthLogger.js
function fileOpened(filePath, addedToWorkingSet, encoding) {
        if (!shouldLogHealthData()) {
            return;
        }
        var fileExtension = FileUtils.getFileExtension(filePath),
            language = LanguageManager.getLanguageForPath(filePath),
            healthData = getStoredHealthData(),
            fileExtCountMap = [];
        healthData.fileStats = healthData.fileStats || {
            openedFileExt     : {},
            workingSetFileExt : {},
            openedFileEncoding: {}
        };
        if (language.getId() !== "unknown") {
            fileExtCountMap = addedToWorkingSet ? healthData.fileStats.workingSetFileExt : healthData.fileStats.openedFileExt;
            if (!fileExtCountMap[fileExtension]) {
                fileExtCountMap[fileExtension] = 0;
            }
            fileExtCountMap[fileExtension]++;
            setHealthData(healthData);
        }
        if (encoding) {
            var fileEncCountMap = healthData.fileStats.openedFileEncoding;
            if (!fileEncCountMap) {
                healthData.fileStats.openedFileEncoding = {};
                fileEncCountMap = healthData.fileStats.openedFileEncoding;
            }
            if (!fileEncCountMap[encoding]) {
                fileEncCountMap[encoding] = 0;
            }
            fileEncCountMap[encoding]++;
            setHealthData(healthData);
        }


        sendAnalyticsData(commonStrings.USAGE + commonStrings.FILE_OPEN + language._name,
                            commonStrings.USAGE,
                            commonStrings.FILE_OPEN,
                            language._name.toLowerCase()
                         );

    }
function fileOpened(filePath, addedToWorkingSet, encoding) {
        if (!shouldLogHealthData()) {
            return;
        }
        var fileExtension = FileUtils.getFileExtension(filePath),
            language = LanguageManager.getLanguageForPath(filePath),
            healthData = getStoredHealthData(),
            fileExtCountMap = [];
        healthData.fileStats = healthData.fileStats || {
            openedFileExt     : {},
            workingSetFileExt : {},
            openedFileEncoding: {}
        };
        if (language.getId() !== "unknown") {
            fileExtCountMap = addedToWorkingSet ? healthData.fileStats.workingSetFileExt : healthData.fileStats.openedFileExt;
            if (!fileExtCountMap[fileExtension]) {
                fileExtCountMap[fileExtension] = 0;
            }
            fileExtCountMap[fileExtension]++;
            setHealthData(healthData);
        }
        if (encoding) {
            var fileEncCountMap = healthData.fileStats.openedFileEncoding;
            if (!fileEncCountMap) {
                healthData.fileStats.openedFileEncoding = {};
                fileEncCountMap = healthData.fileStats.openedFileEncoding;
            }
            if (!fileEncCountMap[encoding]) {
                fileEncCountMap[encoding] = 0;
            }
            fileEncCountMap[encoding]++;
            setHealthData(healthData);
        }


        sendAnalyticsData(commonStrings.USAGE + commonStrings.FILE_OPEN + language._name,
                            commonStrings.USAGE,
                            commonStrings.FILE_OPEN,
                            language._name.toLowerCase()
                         );

    }
function fileOpened ( filePath , addedToWorkingSet , encoding ) { if ( ! shouldLogHealthData ( ) ) { return ; } var fileExtension = FileUtils . getFileExtension ( filePath ) , language = LanguageManager . getLanguageForPath ( filePath ) , healthData = getStoredHealthData ( ) , fileExtCountMap = [ ] ; healthData . fileStats = healthData . fileStats || { openedFileExt : { } , workingSetFileExt : { } , openedFileEncoding : { } } ; if ( language . getId ( ) !== "unknown" ) { fileExtCountMap = addedToWorkingSet ? healthData . fileStats . workingSetFileExt : healthData . fileStats . openedFileExt ; if ( ! fileExtCountMap [ fileExtension ] ) { fileExtCountMap [ fileExtension ] = 0 ; } fileExtCountMap [ fileExtension ] ++ ; setHealthData ( healthData ) ; } if ( encoding ) { var fileEncCountMap = healthData . fileStats . openedFileEncoding ; if ( ! fileEncCountMap ) { healthData . fileStats . openedFileEncoding = { } ; fileEncCountMap = healthData . fileStats . openedFileEncoding ; } if ( ! fileEncCountMap [ encoding ] ) { fileEncCountMap [ encoding ] = 0 ; } fileEncCountMap [ encoding ] ++ ; setHealthData ( healthData ) ; } sendAnalyticsData ( commonStrings . USAGE + commonStrings . FILE_OPEN + language . _name , commonStrings . USAGE , commonStrings . FILE_OPEN , language . _name . toLowerCase ( ) ) ; }
Whenever a file is opened call this function. The function will record the number of times
the standard file types have been opened. We only log the standard filetypes
@param {String} filePath          The path of the file to be registered
@param {boolean} addedToWorkingSet set to true if extensions of files added to the
working set needs to be logged
Whenever a file is opened call this function . The function will record the number of times the standard file types have been opened . We only log the standard filetypes