refinery icon indicating copy to clipboard operation
refinery copied to clipboard

fix logging output for async and sync migrate functions

Open BentEngbers opened this issue 1 year ago • 2 comments

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 avatar Apr 16 '25 09:04 BentEngbers

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

BentEngbers avatar Jun 19 '25 11:06 BentEngbers

I would also like this!

rudolphfroger avatar Jun 19 '25 15:06 rudolphfroger