aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-08-12 04:59:14 +0800
committerKevin Serrano <kevgagser@gmail.com>2016-08-12 04:59:14 +0800
commit9904b4ef5a3d942c97e0585a9f1e4a5ddc7de8e6 (patch)
treead4cdf64e43d0804a735470050794ff5a793ca97
parentffb48028a35e68bf53041cf34e75e7b9acf87aa2 (diff)
downloadtangerine-wallet-browser-9904b4ef5a3d942c97e0585a9f1e4a5ddc7de8e6.tar
tangerine-wallet-browser-9904b4ef5a3d942c97e0585a9f1e4a5ddc7de8e6.tar.gz
tangerine-wallet-browser-9904b4ef5a3d942c97e0585a9f1e4a5ddc7de8e6.tar.bz2
tangerine-wallet-browser-9904b4ef5a3d942c97e0585a9f1e4a5ddc7de8e6.tar.lz
tangerine-wallet-browser-9904b4ef5a3d942c97e0585a9f1e4a5ddc7de8e6.tar.xz
tangerine-wallet-browser-9904b4ef5a3d942c97e0585a9f1e4a5ddc7de8e6.tar.zst
tangerine-wallet-browser-9904b4ef5a3d942c97e0585a9f1e4a5ddc7de8e6.zip
Add ability to hide logging messages in production.
-rw-r--r--app/scripts/config.js3
-rw-r--r--app/scripts/metamask-controller.js7
-rw-r--r--package.json1
-rw-r--r--ui/app/store.js31
4 files changed, 34 insertions, 8 deletions
diff --git a/app/scripts/config.js b/app/scripts/config.js
index 5f6ffd936..297a3a7a0 100644
--- a/app/scripts/config.js
+++ b/app/scripts/config.js
@@ -2,6 +2,7 @@ const MAINET_RPC_URL = 'https://mainnet.infura.io/'
const TESTNET_RPC_URL = 'https://morden.infura.io/'
const DEFAULT_RPC_URL = TESTNET_RPC_URL
const CLASSIC_RPC_URL = 'https://mainnet-nf.infura.io/'
+const DEVELOPMENT_MODE = true
module.exports = {
network: {
@@ -10,5 +11,5 @@ module.exports = {
testnet: TESTNET_RPC_URL,
classic: CLASSIC_RPC_URL,
},
+ developmentMode: DEVELOPMENT_MODE
}
-
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index dd43ac2fc..a5c167223 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -7,6 +7,7 @@ const HostStore = require('./lib/remote-store.js').HostStore
const Web3 = require('web3')
const ConfigManager = require('./lib/config-manager')
const extension = require('./lib/extension')
+const developmentMode = require('./config').developmentMode
module.exports = class MetamaskController {
@@ -93,7 +94,7 @@ module.exports = class MetamaskController {
function logger (err, request, response) {
if (err) return console.error(err)
- if (!request.isMetamaskInternal) {
+ if (developmentMode && !request.isMetamaskInternal) {
console.log(`RPC (${originDomain}):`, request, '->', response)
if (response.error) {
console.error('Error in RPC response:\n', response.error)
@@ -218,7 +219,9 @@ module.exports = class MetamaskController {
// Log blocks
processBlock (block) {
- console.log(`BLOCK CHANGED: #${block.number.toString('hex')} 0x${block.hash.toString('hex')}`)
+ if (developmentMode) {
+ console.log(`BLOCK CHANGED: #${block.number.toString('hex')} 0x${block.hash.toString('hex')}`)
+ }
this.verifyNetwork()
}
diff --git a/package.json b/package.json
index 7389f5e0e..aa62b1e62 100644
--- a/package.json
+++ b/package.json
@@ -35,6 +35,7 @@
"debounce": "^1.0.0",
"dnode": "^1.2.2",
"end-of-stream": "^1.1.0",
+ "envify": "^3.4.1",
"eth-bin-to-ops": "^1.0.0",
"eth-lightwallet": "^2.3.3",
"eth-query": "^1.0.3",
diff --git a/ui/app/store.js b/ui/app/store.js
index ab6422e73..9a88ef8c9 100644
--- a/ui/app/store.js
+++ b/ui/app/store.js
@@ -1,18 +1,39 @@
const createStore = require('redux').createStore
const applyMiddleware = require('redux').applyMiddleware
const thunkMiddleware = require('redux-thunk')
-const createLogger = require('redux-logger')
const rootReducer = require('./reducers')
+const developmentMode = require('../../app/scripts/config').developmentMode
module.exports = configureStore
-const loggerMiddleware = createLogger()
+const middlewares = [thunkMiddleware]
-const createStoreWithMiddleware = applyMiddleware(
- thunkMiddleware,
- loggerMiddleware
+console.log(developmentMode)
+if (developmentMode) {
+ console.log("Development Mode ON.")
+ const createLogger = require('redux-logger')
+ const loggerMiddleware = createLogger()
+ middlewares.push(loggerMiddleware)
+} else {
+ console.log("Development Mode OFF.")
+}
+
+
+const createStoreWithMiddleware = applyMiddleware(...middlewares
)(createStore)
function configureStore (initialState) {
return createStoreWithMiddleware(rootReducer, initialState)
}
+
+// import thunk from 'redux-thunk';
+//
+// const middlewares = [thunk];
+//
+// if (process.env.NODE_ENV === `development`) {
+// const createLogger = require(`redux-logger`);
+// const logger = createLogger();
+// middlewares.push(logger);
+// }
+//
+// const store = compose(applyMiddleware(...middlewares))(createStore)(reducer);