@flareapp/js
v2.6.0
Published
JavaScript client for flareapp.io
Readme
@flareapp/js
The core JavaScript/TypeScript client for Flare error tracking and logging. Captures frontend errors, parses stack traces, collects browser context, sends structured logs, and reports everything to the Flare backend.
Installation
npm install @flareapp/jsQuick start
import { flare } from '@flareapp/js';
flare.light('YOUR_FLARE_API_KEY');That is all you need. The client automatically listens for uncaught exceptions and unhandled promise rejections, collects browser context, and sends error reports to Flare.
Identifying users
Attach the logged-in user to reports so you can see who was affected:
import { flare } from '@flareapp/js';
flare.setUser({
id: 123,
email: '[email protected]',
fullName: 'Jane Doe',
});Recognised fields: id (→ user.id), email (→ user.email), fullName (→ user.full_name), ipAddress (→ client.address). Any extra keys are collected under user.attributes. Pass null to clear the user on logout: flare.setUser(null).
Logging
Beyond errors, the client can send structured logs. Logs are opt-in: enable them with enableLogs, then call any of
the eight syslog levels (debug, info, notice, warning, error, critical, alert, emergency).
flare.configure({ enableLogs: true });
flare.logger.info('Checkout started', { cartId: cart.id, total: cart.total });Logs are buffered and batched, and flushed when the tab is hidden so buffered logs survive a page unload. The optional second argument is structured, searchable attributes.
Documentation
Full documentation on configuration, hooks, context, breadcrumbs, solution providers, and more is available at flareapp.io/docs/javascript/general/installation.
Deprecations
redactFullPathis now a deprecated alias forredactUrlQuery. Both names are still exported and continue to work; preferredactUrlQueryin new code.
License
The MIT License (MIT). Please see License File for more information.
