Skip to content

hymns/alertiqo-client-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alertiqo Node.js SDK

Error tracking SDK for Node.js applications.

Installation

npm install @hymns/alertiqo-node

Usage

Basic Setup

const Alertiqo = require('@hymns/alertiqo-node').default;

const alertiqo = new Alertiqo({
  apiKey: 'your-api-key',
  endpoint: 'https://alertiqo.io',
  environment: 'production',
  release: '1.0.0',
});

alertiqo.init();

Capture Exceptions

try {
  throw new Error('Something went wrong');
} catch (error) {
  alertiqo.captureException(error);
}

Capture Messages

alertiqo.captureMessage('User completed checkout', 'info');

Add Breadcrumbs

alertiqo.addBreadcrumb({
  message: 'User clicked button',
  category: 'user-action',
  level: 'info',
  data: { buttonId: 'submit-btn' }
});

Set User Context

alertiqo.setUser({
  id: '12345',
  email: 'user@example.com',
  username: 'johndoe'
});

Set Tags

alertiqo.setTag('page', 'checkout');
alertiqo.setTags({ 
  feature: 'payments',
  version: '2.1.0'
});

Express Middleware

const express = require('express');
const Alertiqo = require('@hymns/alertiqo-node').default;
const { alertiqoMiddleware } = require('@hymns/alertiqo-node');

const app = express();

const alertiqo = new Alertiqo({
  apiKey: 'your-api-key',
  endpoint: 'https://alertiqo.io',
});

alertiqo.init();

// Add error middleware (after all routes)
app.use(alertiqoMiddleware(alertiqo));

API

new Alertiqo(config)

Creates a new Alertiqo instance.

Config Options:

  • apiKey (required): Your API key
  • endpoint (required): Backend endpoint URL
  • environment: Environment name (default: process.env.NODE_ENV or 'production')
  • release: Release version
  • tags: Default tags for all errors
  • captureUnhandled: Auto-capture uncaught exceptions (default: true)
  • beforeSend: Callback to modify/filter errors before sending

Methods

  • init(): Initialize error handlers
  • captureException(error, additionalData?): Capture an exception
  • captureMessage(message, level?): Capture a message
  • addBreadcrumb(breadcrumb): Add a breadcrumb
  • setUser(user): Set user context
  • setTag(key, value): Set a single tag
  • setTags(tags): Set multiple tags

License

MIT

About

Alertiqo Client for Node

Resources

License

Stars

Watchers

Forks

Packages

No packages published