Skip to main content
Introducing packages.sweber.dev
Logarithm overview

LogarithmLive demo.

This is the settings page of a made-up SaaS app. Every change you make is recorded with the same code as the npm package and shows up in the activity view next to it, the way your customers' admins would see it.

Everything runs in this page and is kept in memory. Nothing you enter is sent anywhere, and a reload starts over.

Try it

Change somethingand see who did what.

Switch the person you act as, edit the project, invite or remove members, rotate the API key. Open Details on an entry to see the field changes. The SMTP password is stored as [redacted], never in clear text.

Acme Cloud · Project settings

Project
Visibility

Members
  • ben@acme.example
  • lea@acme.example

API key: sk_live_…9c1e

Activity

In your app

Three piecesRecord, serve, show.

Record events where things change, expose them through a route that checks access and scopes to the tenant, and drop the view into your admin area.

// app/projects/actions.ts
await audit.with({ tenantId: org.id, actor: { id: user.id, name: user.name } }).record({
  action: "project.updated",
  targets: [{ type: "project", id: project.id, name: project.name }],
  before: project,
  after: updated,
})
// app/api/audit/route.ts
import { createAuditHandler } from "@sweberdev/logarithm"

export const GET = createAuditHandler({
  log: audit,
  async authorize() {
    const session = await getSession()
    return session?.role === "admin" ? { tenantId: session.orgId } : null
  },
})
// app/settings/activity/page.tsx
"use client"
import { AuditLog } from "@sweberdev/logarithm-react"
import "@sweberdev/logarithm-react/styles.css"

export default function Activity() {
  return <AuditLog endpoint="/api/audit" locale="de-CH" />
}

Pro

When auditors askLogarithm Pro has the answers.

Tamper evidence with an HMAC hash chain, retention periods with archiving, GDPR and Swiss FADP erasure and access requests, CSV export for your customers and forwarding to Splunk, Datadog or signed webhooks.