Skip to main content
Structured logging, performance measurement and error tracking, shipped as an installable library. Every log line carries the [mzizi] prefix so one grep finds everything across every service.
The prefix is [mzizi], not [mukoko]. Earlier documentation said [mukoko], and a grep pattern copied from it matches nothing. The prefix is set in lib/observability.ts in mzizi-dev/mzizi-registry.

Install

log

A structured logger with four levels — debug, info, warn, error. Output is prefixed with [mzizi] and optionally scoped to a module.

createLogger

Binds a logger to a module name. Use it in any file that logs more than once.

measure

Times a synchronous or asynchronous function, logs the duration on success and on failure, and returns the function’s result.
Logging on failure as well as success is the part that matters. A timing helper that only records successes tells you your slow path is fast. The default module is perf; pass a module to scope it to your own.

trackError

Records an error without rethrowing it, wrapping a non-Error value automatically.
Be careful what you put in data. It goes to the log, so it is subject to whatever your log retention and access rules are — an identifier is usually enough, and the record it points at is usually not.

Error boundaries log automatically

SectionErrorBoundary calls the logger itself, so wrapping a section is the whole integration:
See error boundaries.

Grep patterns

The square brackets need escaping in a basic grep — unescaped, [mzizi] is a character class matching a single letter, which matches almost every line in the file and looks like it worked.