Send logs to Flashcat from web browser pages with the browser logs SDK.
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)
}