mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-24 02:58:09 +01:00
15 lines
382 B
JavaScript
15 lines
382 B
JavaScript
// 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()
|
|
})
|
|
}
|
|
} |