0.3.2 • Published 5 months ago

@renanvizza-prontmed/browser-logs v0.3.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
5 months ago

Browser Log Collection

Send logs to Datadog from web browser pages with the browser logs SDK.

See the dedicated datadog documentation for more details.

Usage

After adding @datadog/browser-logs to your package.json file, initialize it with:

import { openobserveLogs } from '@renanvizza-prontmed/browser-logs'

openobserveLogs.init({
  clientToken: '<DATADOG_CLIENT_TOKEN>',
  site: '<DATADOG_SITE>',
  forwardErrorsToLogs: true,
  sessionSampleRate: 100,
})

After the Datadog browser logs SDK is initialized, send custom log entries directly to Datadog:

import { openobserveLogs } from '@renanvizza-prontmed/browser-logs'

openobserveLogs.logger.info('Button clicked', { name: 'buttonName', id: 123 })

try {
  ...
  throw new Error('Wrong behavior')
  ...
} catch (ex) {
  openobserveLogs.logger.error('Error occurred', { team: 'myTeam' }, ex)
}
0.3.2

5 months ago

0.3.1

5 months ago

0.3.0

5 months ago