diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-04-16 23:29:43 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-04-19 04:30:22 +0800 |
commit | 603c1310ffc0cdb61a66f68b8240e76c2ae7cb04 (patch) | |
tree | e555cd0a7d6269adc636d14ee3650aac133fdc77 /app/scripts/lib/createLoggerMiddleware.js | |
parent | 061975cd4a92dfcff7c98c2ab34290b8680c5545 (diff) | |
download | tangerine-wallet-browser-603c1310ffc0cdb61a66f68b8240e76c2ae7cb04.tar tangerine-wallet-browser-603c1310ffc0cdb61a66f68b8240e76c2ae7cb04.tar.gz tangerine-wallet-browser-603c1310ffc0cdb61a66f68b8240e76c2ae7cb04.tar.bz2 tangerine-wallet-browser-603c1310ffc0cdb61a66f68b8240e76c2ae7cb04.tar.lz tangerine-wallet-browser-603c1310ffc0cdb61a66f68b8240e76c2ae7cb04.tar.xz tangerine-wallet-browser-603c1310ffc0cdb61a66f68b8240e76c2ae7cb04.tar.zst tangerine-wallet-browser-603c1310ffc0cdb61a66f68b8240e76c2ae7cb04.zip |
Add a few missing docblocks to background files
Diffstat (limited to 'app/scripts/lib/createLoggerMiddleware.js')
-rw-r--r-- | app/scripts/lib/createLoggerMiddleware.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/app/scripts/lib/createLoggerMiddleware.js b/app/scripts/lib/createLoggerMiddleware.js index fc6abf828..996c3477c 100644 --- a/app/scripts/lib/createLoggerMiddleware.js +++ b/app/scripts/lib/createLoggerMiddleware.js @@ -1,16 +1,20 @@ const log = require('loglevel') -// log rpc activity module.exports = createLoggerMiddleware -function createLoggerMiddleware ({ origin }) { - return function loggerMiddleware (req, res, next, end) { - next((cb) => { +/** + * Returns a middleware that logs RPC activity + * @param {{ origin: string }} opts - The middleware options + * @returns {Function} + */ +function createLoggerMiddleware (opts) { + return function loggerMiddleware (/** @type {any} */ req, /** @type {any} */ res, /** @type {Function} */ next) { + next((/** @type {Function} */ cb) => { if (res.error) { log.error('Error in RPC response:\n', res) } if (req.isMetamaskInternal) return - log.info(`RPC (${origin}):`, req, '->', res) + log.info(`RPC (${opts.origin}):`, req, '->', res) cb() }) } |