Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 925 Bytes

File metadata and controls

39 lines (27 loc) · 925 Bytes

Browser Log Collection

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

Usage

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

import { flashcatLogs } from '@flashcatcloud/browser-logs'

flashcatLogs.init({
  clientToken: '<FC_CLIENT_TOKEN>',
  site: '<FC_SITE>',
  forwardErrorsToLogs: true,
  sessionSampleRate: 100,
})

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

import { flashcatLogs } from '@flashcatcloud/browser-logs'

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

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