* feat(types): move Emigrate types to separate package Also refactor the types to use discriminating unions for easier error handling and such. Errors passed to storage plugins should now be serialized and storage plugins are expected to return already serialized errors on failed history entries. * fix(mysql): handle the new type changes * fix(storage-fs): handle the new type changes * feat(cli): better error handling and types Adapt to the new types from the @emigrate/types package, like discriminating union types and serializing and deserializing errors |
||
|---|---|---|
| .. | ||
| src | ||
| CHANGELOG.md | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
@emigrate/reporter-pino
A Pino reporter for Emigrate which logs the migration progress using line delimited JSON by default.
Which is great both in production environments and for piping the output to other tools.
Installation
Install the reporter in your project, alongside the Emigrate CLI:
npm install --save-dev @emigrate/cli @emigrate/reporter-pino
Usage
With default options
Configure the reporter in your emigrate.config.js file:
import reporterPino from '@emigrate/reporter-pino';
export default {
directory: 'migrations',
reporter: reporterPino,
};
Or simply:
export default {
directory: 'migrations',
reporter: 'pino', // the @emigrate/reporter- prefix is optional
};
Or use the CLI option --reporter (or -r):
emigrate up --reporter pino # the @emigrate/reporter- prefix is optional
With custom options
Configure the reporter in your emigrate.config.js file:
import { createPinoReporter } from '@emigrate/reporter-pino';
export default {
directory: 'migrations',
reporter: createPinoReporter({
level: 'error', // default is 'info'
errorKey: 'err', // default is 'error'
}),
};
The log level can also be set using the LOG_LEVEL environment variable:
LOG_LEVEL=error emigrate up -r pino