diff --git a/src/js/services/LogService.js b/src/js/services/LogService.js index e25daa9a..d45f8874 100644 --- a/src/js/services/LogService.js +++ b/src/js/services/LogService.js @@ -5,6 +5,7 @@ import * as LogActions from '../actions/LogActions'; import * as STORAGE from '../actions/constants/localStorage'; import * as SEND from '../actions/constants/send'; import { OPEN, CLOSE, ADD } from '../actions/constants/log'; +import { TRANSPORT, DEVICE } from 'trezor-connect'; import type { Middleware, @@ -24,6 +25,12 @@ const exclude: Array = [ "web3__create" ]; +const include: Array = [ + TRANSPORT.START, + DEVICE.CONNECT, + DEVICE.DISCONNECT +]; + /** * Middleware */ @@ -31,9 +38,15 @@ const LogService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispatch next(action); - if (exclude.indexOf(action.type) < 0) { + // if (exclude.indexOf(action.type) < 0) { + if (include.indexOf(action.type) >= 0) { // api.dispatch(LogActions.add(action.type, JSON.stringify( action ))); - api.dispatch(LogActions.add(action.type, action)); + + if (action.type === TRANSPORT.START) { + api.dispatch(LogActions.add('Transport', action.payload)); + } else if (action.type === DEVICE.CONNECT) { + api.dispatch(LogActions.add(action.type, action)); + } } return action;