migrate-mongo
migrate-mongo copied to clipboard
Add possibility to perform custom code on certain events
Is your feature request related to a problem? Please describe. I would like to write logs when certain things happen, for example a migration script started, completed or failed.
Describe the solution you'd like
Add handlers in the migratie-mongo-config which are used when these events happen. For example:
const config = {
...,
onMigrationStarted: (filename) => { console.log(`Migration ${filename) started`); },
onMigrationCompleted: (filename, err) => {
if (err) {
console.log(`Migration ${filename) failed: ${err.message}`); },
} else {
console.log(`Migration ${filename) completed successfully`); },
}
};
Additional context Would you consider having something like this in this package? If so, I can prepare a PR where this is implemented. Feedback and/or alternative solutions are also very appreciated.
pretty useful also because it allows to use the logging library of our choice