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 2.0 released

Failed and denied actions in the log, correlation ids, CloudEvents and OpenTelemetry mappings, Postgres partitioning and an object history view. Logarithm Pro adds SOC 2 and ISO 27001 control evidence, monthly evidence packs and read-only access for auditors.

Logarithm
Release

Logarithm 0.7.0 released

We ran an axe-core accessibility audit of the audit log viewer in a real browser: no violations in light, dark and German. A new headingLevel option fits the viewer under your page's headings.

Logarithm
Release

Logarithm 0.8.0 released

The API is frozen ahead of 1.0. Eight undocumented helpers left the public exports, and the docs now say exactly what the compatibility promise covers.

Logarithm