Bug 1525406 - Only log actions when desired r=Standard8
authorDavid Walsh <dwalsh@mozilla.com>
Mon, 20 May 2019 11:12:22 +0000
changeset 474522 5f89081950bb50636258a00cfa0d8c4e18414d68
parent 474521 0cc1ad309d1831b09e79bff5a0ac811643b26dda
child 474523 29bdbbe89264b91d1bd4205c45536c9222a8d6ee
push id36041
push userccoroiu@mozilla.com
push dateMon, 20 May 2019 21:55:28 +0000
treeherdermozilla-central@29bdbbe89264 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1525406
milestone69.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 1525406 - Only log actions when desired r=Standard8 Prevents any output coming from the debugger logging actions Differential Revision: https://phabricator.services.mozilla.com/D31660
devtools/client/debugger/src/actions/utils/middleware/log.js
--- a/devtools/client/debugger/src/actions/utils/middleware/log.js
+++ b/devtools/client/debugger/src/actions/utils/middleware/log.js
@@ -92,20 +92,22 @@ function serializeAction(action) {
 /**
  * A middleware that logs all actions coming through the system
  * to the console.
  */
 export function log({ dispatch, getState }: ThunkArgs) {
   return (next: any) => (action: any) => {
     const asyncMsg = !action.status ? "" : `[${action.status}]`;
 
-    if (isTesting() && prefs.logActions) {
-      // $FlowIgnore
-      dump(
-        `[ACTION] ${action.type} ${asyncMsg} - ${serializeAction(action)}\n`
-      );
-    } else {
-      console.log(action, asyncMsg);
+    if (prefs.logActions) {
+      if (isTesting()) {
+        // $FlowIgnore
+        dump(
+          `[ACTION] ${action.type} ${asyncMsg} - ${serializeAction(action)}\n`
+        );
+      } else {
+        console.log(action, asyncMsg);
+      }
     }
 
     next(action);
   };
 }