How to use the @bugsnag/core/lib/es-utils.isoDate function in @bugsnag/core

To help you get started, we’ve selected a few @bugsnag/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bugsnag / bugsnag-js / packages / delivery-node / delivery.js View on Github external
sendReport: (report, cb = () => {}) => {
    const _cb = err => {
      if (err) client._logger.error(`Report failed to send…\n${(err && err.stack) ? err.stack : err}`, err)
      cb(err)
    }

    try {
      request({
        url: client.config.endpoints.notify,
        headers: {
          'Content-Type': 'application/json',
          'Bugsnag-Api-Key': report.apiKey || client.config.apiKey,
          'Bugsnag-Payload-Version': '4',
          'Bugsnag-Sent-At': isoDate()
        },
        body: payload.report(report, client.config.filters),
        agent: client.config.agent
      }, (err, body) => _cb(err))
    } catch (e) {
      _cb(e)
    }
  },
  sendSession: (session, cb = () => {}) => {
github bugsnag / bugsnag-js / packages / delivery-expo / delivery.js View on Github external
sendSession: (session, cb = () => {}) => {
      const url = client.config.endpoints.sessions

      let body, opts
      try {
        body = payload.session(session, client.config.filters)
        opts = {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            'Bugsnag-Api-Key': client.config.apiKey,
            'Bugsnag-Payload-Version': '1',
            'Bugsnag-Sent-At': isoDate()
          },
          body
        }
        if (!networkStatus.isConnected) {
          enqueue('session', { url, opts })
          return cb(null)
        }
        client._logger.info(`Sending session`)
        send(url, opts, err => {
          if (err) return onerror(err, { url, opts }, 'session', cb)
          cb(null)
        })
      } catch (e) {
        onerror(e, { url, opts }, 'session', cb)
      }
    }
github bugsnag / bugsnag-js / packages / delivery-x-domain-request / delivery.js View on Github external
const getApiUrl = (config, endpoint, version, win) =>
  `${matchPageProtocol(config.endpoints[endpoint], win.location.protocol)}?apiKey=${encodeURIComponent(config.apiKey)}&payloadVersion=${version}&sentAt=${encodeURIComponent(isoDate())}`
github bugsnag / bugsnag-js / packages / delivery-expo / delivery.js View on Github external
sendReport: (report, cb = () => {}) => {
      const url = client.config.endpoints.notify
      let body, opts
      try {
        body = payload.report(report, client.config.filters)
        opts = {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            'Bugsnag-Api-Key': report.apiKey,
            'Bugsnag-Payload-Version': '4',
            'Bugsnag-Sent-At': isoDate()
          },
          body
        }
        if (!networkStatus.isConnected || report.events[0].attemptImmediateDelivery === false) {
          enqueue('report', { url, opts })
          return cb(null)
        }
        client._logger.info(`Sending report ${report.events[0].get('errorClass')}: ${report.events[0].get('errorMessage')}`)
        send(url, opts, err => {
          if (err) return onerror(err, { url, opts }, 'report', cb)
          cb(null)
        })
      } catch (e) {
        onerror(e, { url, opts }, 'report', cb)
      }
    },
github bugsnag / bugsnag-js / packages / plugin-expo-device / device.js View on Github external
client.config.beforeSend.unshift(report => {
      report.device = {
        ...report.device,
        time: isoDate(),
        orientation
      }
      report.updateMetaData('device', {
        isDevice: Constants.isDevice,
        appOwnership: Constants.appOwnership
      })
    })
  }
github bugsnag / bugsnag-js / packages / plugin-node-device / device.js View on Github external
client.config.beforeSend.unshift((report) => {
      report.device = { ...report.device, time: isoDate() }
    })
  }
github bugsnag / bugsnag-js / packages / plugin-browser-device / device.js View on Github external
client.config.beforeSend.unshift((report) => {
      report.device = { ...report.device, time: isoDate() }
    })
  }
github bugsnag / bugsnag-js / packages / delivery-xml-http-request / delivery.js View on Github external
sendSession: (session, cb = () => {}) => {
    try {
      const url = client.config.endpoints.sessions
      const req = new win.XMLHttpRequest()
      req.onreadystatechange = function () {
        if (req.readyState === win.XMLHttpRequest.DONE) cb(null)
      }
      req.open('POST', url)
      req.setRequestHeader('Content-Type', 'application/json')
      req.setRequestHeader('Bugsnag-Api-Key', client.config.apiKey)
      req.setRequestHeader('Bugsnag-Payload-Version', '1')
      req.setRequestHeader('Bugsnag-Sent-At', isoDate())
      req.send(payload.session(session, client.config.filters))
    } catch (e) {
      client._logger.error(e)
    }
  }
})