@elliemae/pui-diagnostics
v3.12.1
Published
Javascript diagnostics library
Readme
Diagnostics Library
pui-diagnostics is a framework-agnostic JavaScript library for logging messages from web applications, following ICEMT logging guidelines.
Quick Start
import {
logger,
http,
logUnhandledErrors,
webvitals,
} from '@elliemae/pui-diagnostics';
const appLogger = logger({
transport: http('https://int.api.ellielabs.com/diagnostics/v2/logging'),
index: 'myapp',
team: 'my team',
appName: 'Hello World App',
});
logUnhandledErrors(appLogger);
webvitals(appLogger);
appLogger.info('Application launched');Reducing API Load
The HTTP transport supports options to control log volume:
const transport = http('https://api.ellielabs.com/diagnostics/v2/logging', {
flushInterval: 15000, // flush batched logs every 15s (default: 10s)
maxBatchSize: 50, // flush early at 50 buffered logs (default: 100)
maxLogsPerInterval: 200, // cap non-critical logs per window (default: unlimited)
samplingRate: 0.5, // send ~50% of non-critical logs (default: 1 = all)
});WARN, ERROR, and FATAL logs are always sent immediately and bypass batching, sampling, and rate limiting.
