feat(reporter): print Emigrate CLI's version number and relative paths to migrations (#39)
* feat(reporter-default): print CLI version number * feat(reporter-default): print relative paths to migrations instead of only the file names This makes the output clickable in most shells * feat(reporter-pino): include the Emigrate CLI version in each log
This commit is contained in:
parent
480796e95b
commit
1434be5d5e
5 changed files with 28 additions and 9 deletions
|
|
@ -42,7 +42,7 @@ class PinoReporter implements Required<EmigrateReporter> {
|
|||
return this.options.errorKey ?? 'error';
|
||||
}
|
||||
|
||||
onInit({ command, ...parameters }: ReporterInitParameters): Awaitable<void> {
|
||||
onInit({ command, version, ...parameters }: ReporterInitParameters): Awaitable<void> {
|
||||
this.#command = command;
|
||||
this.#logger = pino({
|
||||
name: 'emigrate',
|
||||
|
|
@ -50,6 +50,7 @@ class PinoReporter implements Required<EmigrateReporter> {
|
|||
errorKey: this.errorKey,
|
||||
base: {
|
||||
scope: command,
|
||||
version,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -171,11 +172,14 @@ class PinoReporter implements Required<EmigrateReporter> {
|
|||
|
||||
if (error) {
|
||||
this.#logger.error(
|
||||
{ failed, done, skipped, pending, total, [this.errorKey]: error },
|
||||
{ result: { failed, done, skipped, pending, total }, [this.errorKey]: error },
|
||||
`Emigrate "${this.#command}" failed`,
|
||||
);
|
||||
} else {
|
||||
this.#logger.info({ failed, done, skipped, pending, total }, `Emigrate "${this.#command}" finished successfully`);
|
||||
this.#logger.info(
|
||||
{ result: { failed, done, skipped, pending, total } },
|
||||
`Emigrate "${this.#command}" finished successfully`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue