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

logtap-sdk

v0.1.1

Published

logtap browser/node logging + tracking SDK

Downloads

170

Readme

logtap JS SDK(Browser / Node)

用于向 logtap 网关上报「结构化日志」与「埋点事件」。

配置

import { LogtapClient } from "logtap-sdk";

const client = new LogtapClient({
  baseUrl: "http://localhost:8080",
  projectId: 1,
  projectKey: "pk_xxx", // 启用 AUTH_SECRET 时必填
  gzip: true, // 浏览器需要支持 CompressionStream;否则会自动降级为非 gzip
  // 批处理:尽量攒够再发,避免请求过多
  flushIntervalMs: 5000, // 最大延迟(到时间也会发)
  minBatchSize: 20,      // 达到条数立即发
  // 关键事件:绕过批处理立即上报(只影响 track)
  immediateEvents: ["purchase", "payment_succeeded"],
  globalContexts: { app: { version: "1.2.3" } },
});

日志

client.info("hello", { k: "v" });
client.error("boom", { err: String(err), stack: err?.stack });

埋点

client.identify("u1", { plan: "pro" });
client.track("signup", { from: "landing" });
client.track("purchase", { amount: 1 }, { immediate: true }); // 单次强制立即上报

也支持在单次调用里带 contexts/extra/user/deviceId(覆盖全局默认值):

client.info("hello", { k: "v" }, { contexts: { page: { path: location.pathname } } });

事件上报会调用 POST /api/:projectId/track/,服务端会以 logs.level=event 落库并用于事件分析/漏斗。

自动捕获(可选)

client.captureBrowserErrors(); // 浏览器:window.error / unhandledrejection
client.captureNodeErrors();    // Node:unhandledRejection / uncaughtException

Flush / 退出前发送

SDK 会把日志/事件先放在本地队列里,满足「条数阈值」或「时间阈值」才上报;也可手动调用:

await client.flush();
await client.close();