Browse Source

Also log the POST data

master
Gaëtan Renaudeau 6 years ago
parent
commit
870e8e8a31
No known key found for this signature in database GPG Key ID: 7B66B85F042E5451
  1. 4
      src/api/network.js
  2. 3
      src/logger/logger.js

4
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 = <A>(p: Promise<A>, { url, method, startTime }): Promise<A> =>
const userFriendlyError = <A>(p: Promise<A>, { url, method, startTime, ...rest }): Promise<A> =>
p.catch(error => {
let errorToThrow
if (error.response) {
@ -47,6 +47,7 @@ const userFriendlyError = <A>(p: Promise<A>, { 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)

3
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',

Loading…
Cancel
Save