Satori is an observable event logging library for JavaScript/TypeScript. It provides structured logging with advanced features like state watching, causal linking, filtering, rate limiting, and persistence.

Satori means “awakening” or “understanding” in Japanese: the moment of sudden enlightenment. This library helps you achieve that clarity in your application’s behavior.

Features

Zero Configuration

Get started instantly with sensible defaults. No complex setup required.

State Watching

Automatically detect and log state changes with minimal code.

Causal Linking

Trace cause-and-effect relationships between events.

Advanced Filtering

Query events by level, scope, tags, time range, and more.

Quick Example

import { createSatori } from '@nisoku/satori-log';

const satori = createSatori();
const logger = satori.createLogger('myApp');

// Basic logging
logger.info('User logged in', { 
  tags: ['auth'],
  state: { userId: '123' }
});

// Watch for state changes
const store = { count: 0 };
logger.watch(() => store.count, 'counter');
store.count++;  // Automatically logs the change

// Subscribe to events
satori.bus.subscribe((event) => {
  console.log(`[${event.level}] ${event.message}`);
});

Installation

npm install @nisoku/satori-log

Satori is available on NPM!

Next Steps