@biwave/core
v0.4.1
Published
Biwave SDK core — Client, envelope builder, transport, stack trace parser, breadcrumbs, scope, logging & Pulse batching
Maintainers
Readme
@biwave/core
Runtime-agnostic core foundation for Biwave JavaScript / TypeScript SDKs.
Features
- Runtime Agnostic: Works in Node.js, browsers, Edge runtimes, Deno, and Bun (requires standard
fetch,TextEncoder, andcrypto.randomUUID). - Core Client (
BiwaveClient): Manages error capturing, logging buffers, and Pulse performance monitoring spans. - Envelope Builder: Formats exception events into NDJSON envelopes for the
/api/traceingest endpoint. - Batched Logging & Pulse Spans: Efficiently batches logs (
/api/log) and performance spans (/api/pulse) to minimize network overhead. - Breadcrumbs & Scope: Tracks user actions, context headers, user info, tags, and request-level scope.
- Stack Trace Parser: Cross-platform stack trace parsing into clean frame arrays.
Installation
# pnpm
pnpm add @biwave/core
# npm
npm install @biwave/core
# yarn
yarn add @biwave/coreBasic Usage
import { BiwaveClient } from '@biwave/core';
const client = new BiwaveClient({
clientId: 'your-client-id',
environment: 'production',
});
// Capture an exception
try {
throw new Error('Something went wrong');
} catch (err) {
client.captureException(err);
}
// Structured logging (batched automatically)
client.info('User completed checkout', { orderId: '12345' });
client.error('Payment gateway timeout', { gateway: 'stripe' });
// Performance span (Biwave Pulse)
await client.withSpan('db.query', 'SELECT * FROM users', async () => {
return await db.query('SELECT * FROM users');
});
// Explicitly flush pending events before exit
await client.flush();License
MIT © Bitech.id
