Docs

Custom Events

Log feature usage, milestones, and product-specific moments. If you'd tell a teammate about it, log it.


Any channel works

The first argument to logit.now() is a free-form string. Invent channels that match your product: "features", "milestones", "jobs" — whatever makes your inbox readable.

Feature usage

ts
// First time a feature is used
if (isFirstUse) {
  await logit.now("features", {
    event: "CSV export used for first time",
    description: `${user.email} triggered the export feature`,
    icon: "📤",
    notify: true,
    tags: { feature: "csv-export", firstUse: "true", plan: user.plan },
    metadata: { userId: user.id, email: user.email },
  });
}

User milestones

ts
await logit.now("milestones", {
  event: "User hit 100 projects",
  description: `${user.email} created their 100th project`,
  icon: "🏆",
  tags: { milestone: "100-projects", plan: user.plan },
  metadata: { userId: user.id, projectCount: 100 },
});

Background jobs

ts
await logit.now("jobs", {
  event: "Weekly digest sent",
  icon: "📧",
  tags: { job: "weekly-digest", status: "success" },
  metadata: {
    recipientCount: sentCount,
    durationMs: Date.now() - startedAt,
  },
});

Tagging tips

  • Keep tag keys consistent — plan, status, feature.
  • Keep tag values short — "pro" not "Pro Plan ($49/mo)".
  • Put high-cardinality data (emails, IDs) in metadata, not tags.
ts
// ✅ Good
tags: { plan: "pro", env: "production", feature: "csv-export" }

// ❌ Avoid — put these in metadata instead
tags: { userEmail: user.email, chargeId: charge.id }