Bug 1319972 - write a session ID to sync logs. r?tcsc draft
authorMark Hammond <mhammond@skippinet.com.au>
Fri, 17 Feb 2017 15:38:11 +1100
changeset 485772 d0801a06671693daf65fc11bb49c3e62fc87beea
parent 485692 6cefe01ca7744d6ac3960c69eac833e2e65f7f8f
child 546113 ae4d2ae4098d94ad9799b6284d018f6cdadf618e
push id45838
push userbmo:markh@mozilla.com
push dateFri, 17 Feb 2017 04:38:36 +0000
reviewerstcsc
bugs1319972
milestone54.0a1
Bug 1319972 - write a session ID to sync logs. r?tcsc MozReview-Commit-ID: GY8tvMVJ0p1
services/sync/modules/service.js
--- 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;
         }