Bug 1319972 - write a session ID to sync logs. r?tcsc
MozReview-Commit-ID: GY8tvMVJ0p1
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -46,16 +46,21 @@ const ENGINE_MODULES = {
ExtensionStorage: "extension-storage.js",
};
const STORAGE_INFO_TYPES = [INFO_COLLECTIONS,
INFO_COLLECTION_USAGE,
INFO_COLLECTION_COUNTS,
INFO_QUOTA];
+// A unique identifier for this browser session. Used for logging so
+// we can easily see whether 2 logs are in the same browser session or
+// after the browser restarted.
+XPCOMUtils.defineLazyGetter(this, "browserSessionID", Utils.makeGUID);
+
function Sync11Service() {
this._notify = Utils.notify("weave:service:");
}
Sync11Service.prototype = {
_lock: Utils.lock,
_locked: false,
_loggedIn: false,
@@ -1072,17 +1077,17 @@ Sync11Service.prototype = {
return "";
return reason;
},
sync: function sync(engineNamesToSync) {
let dateStr = Utils.formatTimestamp(new Date());
this._log.debug("User-Agent: " + Utils.userAgent);
- this._log.info("Starting sync at " + dateStr);
+ this._log.info(`Starting sync at ${dateStr} in browser session ${browserSessionID}`);
this._catch(function() {
// Make sure we're logged in.
if (this._shouldLogin()) {
this._log.debug("In sync: should login.");
if (!this.login()) {
this._log.debug("Not syncing: login returned false.");
return;
}