Skip to content

Pino Reporter

Emigrate’s reporter that uses Pino as the logger.

This is useful in production environments where you want all logs as JSON, which is suitable for log aggregators/shippers.

Installation

Terminal window
npm install @emigrate/reporter-pino

Usage

Via CLI

Terminal window
npx emigrate <command> --reporter pino

See for instance the Reporter Option for the up command for more information.

Via configuration file

emigrate.config.js
/** @type {import('@emigrate/cli').EmigrateConfig} */
export default {
reporter: 'pino',
};

See Reporter Configuration for more information.

Example output

{"level":30,"time":1702907697803,"scope":"list","version":"0.10.0","name":"emigrate","parameters":{"cwd":"/your/project/dir","dry":false,"directory":"migration-folder"},"msg":"Emigrate \"list\" initialized"}
{"level":30,"time":1702907697836,"scope":"list","version":"0.10.0","name":"emigrate","migrationCount":1,"msg":"1 pending migrations to run"}
{"level":30,"time":1702907697836,"scope":"list","version":"0.10.0","name":"emigrate","migration":"migration-folder/20231218135441244_create_some_table.sql","msg":"20231218135441244_create_some_table.sql (pending)"}
{"level":30,"time":1702907697836,"scope":"list","version":"0.10.0","name":"emigrate","result":{"failed":0,"done":0,"skipped":0,"pending":1,"total":1},"msg":"Emigrate \"list\" finished successfully"}