npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@customerlog/sdk

v0.2.2

Published

class.log SDK — monitor events from your code

Downloads

43

Readme

@customerlog/sdk

The official Node.js / TypeScript SDK for customer.log.

Monitor events from your backend, CLI, or anywhere JavaScript runs. One function call — events appear in your live dashboard and ping your team on Slack, email, and more.

import { CustomerLog } from "@customerlog/sdk";

const customer = new CustomerLog({ apiKey: "cl_xxx" });

await customer.log({
  channel: "signups",
  title: "User signed up",
  level: "success",
  user: { id: "usr_123", email: "[email protected]" },
});

Installation

npm install @customerlog/sdk
# or
yarn add @customerlog/sdk
# or
pnpm add @customerlog/sdk

Quick start

import { CustomerLog } from "@customerlog/sdk";

const customer = new CustomerLog({
  apiKey: process.env.CUSTOMER_LOG_API_KEY!,
});

// Log an event
await customer.log({
  channel: "payments",
  title: "Payment succeeded",
  message: "User purchased the Pro plan",
  level: "success",
  user: { id: "usr_456", email: "[email protected]", name: "Alex" },
  metadata: { plan: "pro", amount: 29.99, currency: "USD" },
  url: "https://yourapp.com/admin/orders/ord_789",
  notify: true,
});

API

new CustomerLog(config)

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiKey | string | — | Required. Your project's API key | | baseUrl | string | https://event.customerlog.byorello.space | Override the ingestion endpoint (for self-hosted or dev) |

customer.log(options)

| Field | Type | Default | Description | |-------|------|---------|-------------| | channel | string | — | Required. Routing bucket, e.g. "signups", "payments" | | title | string | — | Required. Human-readable headline | | message | string? | — | Free-text detail | | level | string? | "info" | One of "info", "success", "warning", "error" — drives default icon and color | | user | object? | — | { id: string; email?: string; name?: string } | | metadata | object? | — | Anything structured — passed through to your dashboard | | tags | string[]? | — | Categorisation tags | | icon | string? | — | Override the level-based default icon (any Phosphor icon name) | | url | string? | — | Deep link back to the record in your own app | | notify | boolean? | true | Whether to trigger channel delivery | | dedupeKey | string? | — | Idempotency guard — same key returns existing event | | timestamp | string \| Date? | now | Override event time (for backfills / batched imports) | | groupId | string? | — | Links related events into one thread in the dashboard |

Returns

{
  message: string;
  event: {
    id: string;
    channel: string;
    title: string;
    message?: string;
    level?: string;
    user?: { id: string; email?: string; name?: string };
    metadata?: Record<string, unknown>;
    tags?: string[];
    icon?: string;
    url?: string;
    notify: boolean;
    groupId?: string;
    createdAt: string;
  };
}

Errors

customer.log() throws CustomerLogError on validation or server errors. The status property contains the HTTP status code.

import { CustomerLog, CustomerLogError } from "@customerlog/sdk";

try {
  await customer.log({ channel: "", title: "" });
} catch (err) {
  if (err instanceof CustomerLogError) {
    console.error(err.status, err.message); // 400, "channel is required"
  }
}

Examples

Track a signup

await customer.log({
  channel: "signups",
  title: "New user registered",
  level: "success",
  user: { id: "usr_789", email: "[email protected]", name: "Sam" },
  metadata: { source: "google-oauth", referral: "friend-invite" },
});

Alert on failure

await customer.log({
  channel: "payments",
  title: "Payment failed",
  message: "Stripe charge declined: card_not_supported",
  level: "error",
  user: { id: "usr_456" },
  metadata: { charge_id: "ch_xxx", error_code: "card_declined" },
  url: "https://yourapp.com/admin/orders/ord_789",
  notify: true,
});

Deduplicate webhook retries

await customer.log({
  channel: "stripe-webhooks",
  title: "Invoice paid",
  dedupeKey: "evt_webhook_abc123", // Stripe may retry; this key ensures one event
  metadata: { invoice_id: "in_xxx" },
});

License

MIT