diff --git a/src/api/network.js b/src/api/network.js index eac84f7f..0da18166 100644 --- a/src/api/network.js +++ b/src/api/network.js @@ -6,7 +6,7 @@ import logger from 'logger' import { LedgerAPIErrorWithMessage, LedgerAPIError, NetworkDown } from 'config/errors' import anonymizer from 'helpers/anonymizer' -const userFriendlyError = (p: Promise, { url, method, startTime }): Promise => +const userFriendlyError = (p: Promise, { url, method, startTime, ...rest }): Promise => p.catch(error => { let errorToThrow if (error.response) { @@ -47,6 +47,7 @@ const userFriendlyError = (p: Promise, { url, method, startTime }): Promis }) } logger.networkError({ + ...rest, status, url, method, @@ -80,6 +81,7 @@ let implementation = (arg: Object) => { const meta = { url: arg.url, method: arg.method, + data: arg.data, startTime: Date.now(), } logger.network(meta) diff --git a/src/logger/logger.js b/src/logger/logger.js index 58eaf83b..072bf7d8 100644 --- a/src/logger/logger.js +++ b/src/logger/logger.js @@ -273,6 +273,7 @@ export default { status, error, responseTime, + ...rest }: { method: string, url: string, @@ -285,7 +286,7 @@ export default { 0, )}ms` if (logNetwork) { - logger.log('info', log, { type: 'network-error', status, method }) + logger.log('info', log, { type: 'network-error', status, method, ...rest }) } captureBreadcrumb({ category: 'network',