Skip to content

fix logging output for async and sync migrate functions #378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

BentEngbers
Copy link

@BentEngbers BentEngbers commented Apr 16, 2025

The previous log messages, which included applied_migrations.iter().map(ToString::to_string), used the debug implementation for displaying the applied migrations. This created a lot of output in the logs, which I believe was unintentional.

I have replaced them with:

let migrations_display = applied_migrations
                                .iter()
                                .map(ToString::to_string)
                                .collect::<Vec<String>>()
                                .join("\n");

To compare the output of the new and old version, see the output of the following Rust playground link for the difference.


Additionally, for easier debugging of long-running migrations (when not in batch mode), a log message is now added before and after each migration. These messages are aligned with an extra space:

[2025-05-15T13:49:33Z INFO  refinery_core::traits::sync] applying migration: V1__foo ...
[2025-05-15T13:49:34Z INFO  refinery_core::traits::sync] applied migration:  V1__foo writing state to db.
[2025-05-15T13:49:34Z INFO  refinery_core::traits::sync] applying migration: V2__bar ...
[2025-05-15T13:49:34Z INFO  refinery_core::traits::sync] applied migration:  V2__bar writing state to db.

@BentEngbers BentEngbers changed the title improve logging output for async and sync migrate functions fix logging output for async and sync migrate functions Jun 19, 2025
@BentEngbers
Copy link
Author

I submitted this PR a while ago and haven't heard back. Is there anything I can do to help move it forward?

@rudolphfroger
Copy link

I would also like this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants