Create global variable that changes ui logging.

feature/default_network_editable
Kevin Serrano 8 years ago
parent b8856d765d
commit 2b0c6953e2
  1. 2
      app/scripts/config.js
  2. 5
      app/scripts/metamask-controller.js
  3. 5
      ui/app/conversion-util.js
  4. 12
      ui/app/store.js

@ -2,7 +2,6 @@ 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 = false
module.exports = {
network: {
@ -11,5 +10,4 @@ module.exports = {
testnet: TESTNET_RPC_URL,
classic: CLASSIC_RPC_URL,
},
developmentMode: DEVELOPMENT_MODE,
}

@ -7,7 +7,6 @@ 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 {
@ -95,9 +94,7 @@ module.exports = class MetamaskController {
function logger (err, request, response) {
if (err) return console.error(err)
if (!request.isMetamaskInternal) {
if (developmentMode) {
console.log(`RPC (${originDomain}):`, request, '->', response)
}
if (response.error) {
console.error('Error in RPC response:\n', response.error)
}
@ -221,9 +218,7 @@ module.exports = class MetamaskController {
// Log blocks
processBlock (block) {
if (developmentMode) {
console.log(`BLOCK CHANGED: #${block.number.toString('hex')} 0x${block.hash.toString('hex')}`)
}
this.verifyNetwork()
}

File diff suppressed because one or more lines are too long

@ -2,17 +2,17 @@ const createStore = require('redux').createStore
const applyMiddleware = require('redux').applyMiddleware
const thunkMiddleware = require('redux-thunk')
const rootReducer = require('./reducers')
const developmentMode = require('../../app/scripts/config').developmentMode
const createLogger = require('redux-logger')
global.METAMASK_DEBUG = false
module.exports = configureStore
const middlewares = [thunkMiddleware]
const loggerMiddleware = createLogger({
predicate: () => global.METAMASK_DEBUG ? true : false
})
if (developmentMode) {
const loggerMiddleware = createLogger()
middlewares.push(loggerMiddleware)
}
const middlewares = [thunkMiddleware, loggerMiddleware]
const createStoreWithMiddleware = applyMiddleware(...middlewares)(createStore)

Loading…
Cancel
Save