Created
July 3, 2020 17:05
-
-
Save xsolon/7ebb15e49c8fc9c65b989e9e23f4ce29 to your computer and use it in GitHub Desktop.
SharePoint CacheLogger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var logger = (function () { | |
var id = 'MartinLog'; | |
var baseLogger = new BaseLogger.Logger(function (json) { | |
console.log(json); | |
for (d in sessionStorage) { | |
if (d.indexOf('id') == 0) { | |
sessionStorage.removeItem(d); | |
} | |
} | |
}); | |
baseLogger.SetCorrelationId(id); | |
// CacheLogger.DefaultUploader uploads every 5 seconds | |
var uploaderInstance = null; | |
var myUploader = function (uploadFunc) { | |
uploaderInstance = this; | |
this.CanUpload = function () { | |
console.log('CanUpload'); | |
return cacheLogger.canUpload; | |
}; | |
this.OnLog = function () { | |
console.log('OnLog'); | |
}; | |
this.Upload = function () { | |
uploadFunc(); | |
} | |
this.OnUpload = function () { | |
console.log('OnUpload'); | |
}; | |
}; | |
var cacheLogger = new CacheLogger.Logger(id, baseLogger, myUploader); | |
cacheLogger.canUpload = false; | |
cacheLogger.Report = function () { | |
cacheLogger.canUpload = true; | |
g_wsaEnabled = true; | |
// cacheLogger.WriteLog('log', { d: 1 }); | |
uploaderInstance.Upload(); | |
}; | |
return cacheLogger; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment