1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Add ui state logging function

Now from the UI console, you can always call `logState()`, and it will print the state stringified into the console, ready to drop into the ui dev mode states folder, or other inspection.

This should make it easier to diagnose user bugs in the future.
This commit is contained in:
Dan Finlay 2016-07-15 17:51:37 -07:00
parent c4812b3452
commit 203a56fb92

View File

@ -7,6 +7,8 @@ const reduceIdentities = require('./reducers/identities')
const reduceMetamask = require('./reducers/metamask') const reduceMetamask = require('./reducers/metamask')
const reduceApp = require('./reducers/app') const reduceApp = require('./reducers/app')
window.METAMASK_CACHED_LOG_STATE = null
module.exports = rootReducer module.exports = rootReducer
function rootReducer (state, action) { function rootReducer (state, action) {
@ -35,5 +37,11 @@ function rootReducer (state, action) {
state.appState = reduceApp(state, action) state.appState = reduceApp(state, action)
window.METAMASK_CACHED_LOG_STATE = state
return state return state
} }
window.logState = function() {
var stateString = JSON.stringify(window.METAMASK_CACHED_LOG_STATE, null, 2)
console.log(stateString)
}