diff options
author | Kevin Serrano <kevin.serrano@consensys.net> | 2017-09-19 02:46:10 +0800 |
---|---|---|
committer | Kevin Serrano <kevin.serrano@consensys.net> | 2017-09-19 02:46:10 +0800 |
commit | 51f0911f8734745bed452e07f7bf1e5dc7211235 (patch) | |
tree | 6594bf81b2b42e8d2511435fd3058f1682177b10 /app/scripts/lib/createLoggerMiddleware.js | |
parent | 456ceefcf7967423ea66e81d2108ffcb0e144082 (diff) | |
parent | c463647ad7a825eb954a56599ec205a3ba6cd3e6 (diff) | |
download | tangerine-wallet-browser-51f0911f8734745bed452e07f7bf1e5dc7211235.tar tangerine-wallet-browser-51f0911f8734745bed452e07f7bf1e5dc7211235.tar.gz tangerine-wallet-browser-51f0911f8734745bed452e07f7bf1e5dc7211235.tar.bz2 tangerine-wallet-browser-51f0911f8734745bed452e07f7bf1e5dc7211235.tar.lz tangerine-wallet-browser-51f0911f8734745bed452e07f7bf1e5dc7211235.tar.xz tangerine-wallet-browser-51f0911f8734745bed452e07f7bf1e5dc7211235.tar.zst tangerine-wallet-browser-51f0911f8734745bed452e07f7bf1e5dc7211235.zip |
Merge branch 'master' into new-currency-test
Diffstat (limited to 'app/scripts/lib/createLoggerMiddleware.js')
-rw-r--r-- | app/scripts/lib/createLoggerMiddleware.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/scripts/lib/createLoggerMiddleware.js b/app/scripts/lib/createLoggerMiddleware.js new file mode 100644 index 000000000..b92a965de --- /dev/null +++ b/app/scripts/lib/createLoggerMiddleware.js @@ -0,0 +1,15 @@ +// log rpc activity +module.exports = createLoggerMiddleware + +function createLoggerMiddleware({ origin }) { + return function loggerMiddleware (req, res, next, end) { + next((cb) => { + if (res.error) { + log.error('Error in RPC response:\n', res) + } + if (req.isMetamaskInternal) return + log.info(`RPC (${origin}):`, req, '->', res) + cb() + }) + } +}
\ No newline at end of file |