Skip to main content
Introducing packages.sweber.dev
All posts
Release1 min read

Logarithm 0.5.0 released

A conformance suite so your own audit-log store behaves exactly like the built-in ones, a verified WCAG AA contrast for the viewer, and new guides for migrations, Drizzle and Prisma.

By Seya Weber

Logarithm 0.5.0 is out. @sweberdev/logarithm and @sweberdev/logarithm-react are on npm. Nothing breaks: 0.4.0 code keeps working as it is. (Logarithm Pro has its own version numbers and is at 0.7.0.)

A conformance suite for your own store

Logarithm ships stores for Postgres, MySQL, MariaDB and SQLite, and AuditStore is a small interface if you need another database. The hard part is not the interface, it is the details: newest-first ordering, paging across events in the same millisecond, tenant isolation, searches that treat % and _ literally. @sweberdev/logarithm/testing now ships the same checks the built-in stores run:

import { storeConformanceChecks } from "@sweberdev/logarithm/testing"
import { describe, it } from "vitest" // or jest, node:test

describe("my store", () => {
  for (const check of storeConformanceChecks) {
    it(check.name, () => check.run(async () => {
      await truncateTable()
      return myStore(client)
    }))
  }
})

A failing check names what differed. A store that ignores tenants, for example, fails "isolates tenants", which is exactly the bug that would leak one customer's audit log to another. Without a test runner, runStoreConformance(factory) returns the list of failures.

Contrast you can rely on

The viewer's default stylesheet is now checked by a test: every text and background colour pair in the light and the dark theme meets the WCAG AA contrast of 4.5:1. The docs describe the theming variables, the keyboard and screen reader behaviour, and what to keep in mind when you change the colours.

Guides for migrations, Drizzle and Prisma

  • Migrations and upgrades: the idempotent migrate* functions, how to put the SQL into your own migration tool, and what to do with very large tables.
  • Drizzle and Prisma: share your connection pool with Logarithm and keep the audit table in your ORM's migration history.

Update

pnpm add @sweberdev/logarithm@latest @sweberdev/logarithm-react@latest
Package in this post

Logarithm

A self-hosted audit log for SaaS apps: who changed what, and when. Field-level diffs in your own Postgres or SQLite, and a ready React view for your customers' admins.

pnpm add @sweberdev/logarithm @sweberdev/logarithm-react
View package

Related posts

Release

Logarithm 0.3.0 released

Counts and breakdowns for dashboards, typed action catalogs, a MySQL and MariaDB store, and in Logarithm Pro alerts to Slack and Teams plus anomaly detection for unusual exports, deletions and failed logins.

Logarithm
Release

Logarithm 0.4.0 released

French and Italian for the activity log, and in Logarithm Pro an S3 and Cloudflare R2 archive for expired events plus log entries that prove your retention policy and erasures actually ran.

Logarithm
Release

Logarithm Pro 0.5.0 released

Trusted RFC 3161 timestamps for integrity checkpoints, and a retention report with the legal basis per tenant that you can hand to an auditor as CSV or a printable page.

Logarithm