Bug 1473513 - make log function safer so that tests do not time out; r=ochameau
authoryulia <ystartsev@mozilla.com>
Wed, 26 Sep 2018 10:04:57 +0200
changeset 438499 6dab963c9f14f0e805507a118a5d819812bb2a70
parent 438498 3612d32de44c03cf26a2b8b739471329313cf9ef
child 438500 f8e02f7e5e2d83a8f5e8405135f0d08ab07c7a43
push id108323
push userystartsev@mozilla.com
push dateThu, 27 Sep 2018 10:55:25 +0000
treeherdermozilla-inbound@48445cd6f7c5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1473513
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1473513 - make log function safer so that tests do not time out; r=ochameau Summary: MozReview-Commit-ID: BIk5pWzxJcx Depends on D6470 Reviewers: ochameau Reviewed By: ochameau Bug #: 1473513 Differential Revision: https://phabricator.services.mozilla.com/D6471
devtools/client/shared/redux/middleware/log.js
--- a/devtools/client/shared/redux/middleware/log.js
+++ b/devtools/client/shared/redux/middleware/log.js
@@ -5,17 +5,27 @@
 
 /**
  * A middleware that logs all actions coming through the system
  * to the console.
  */
 function log({ dispatch, getState }) {
   return next => action => {
     try {
-      console.log("[DISPATCH]", JSON.stringify(action, null, 2));
+      // whitelist of fields, rather than printing the whole object
+      console.log("[DISPATCH] action type:", action.type);
+      /*
+       * USE WITH CAUTION!! This will output everything from an action object,
+       * and these can be quite large. Printing out large objects will slow
+       * down tests and cause test failures
+       *
+       * console.log("[DISPATCH]", JSON.stringify(action, null, 2));
+       */
     } catch (e) {
+      // this occurs if JSON.stringify throws.
+      console.warn(e);
       console.log("[DISPATCH]", action);
     }
     next(action);
   };
 }
 
 exports.log = log;