migratrom 0.2.0

Declarative, self-verifying database migrations (core engine).
Documentation
//! Structured logging hook for the runner.
//!
//! A small trait keeps the engine decoupled from any logging framework. Wire in
//! `tracing`/`log` by implementing [`MigrationLogger`] over them if desired.

/// Receives progress messages from the runner.
pub trait MigrationLogger: Send + Sync {
    /// Record routine migration progress.
    fn info(&self, message: &str);
    /// Record a recoverable or noteworthy migration condition.
    fn warn(&self, message: &str);
    /// Record a migration failure.
    fn error(&self, message: &str);
}

/// Default logger writing info/warn to stdout and errors to stderr.
#[derive(Clone, Copy, Debug, Default)]
pub struct ConsoleLogger;

impl MigrationLogger for ConsoleLogger {
    fn info(&self, message: &str) {
        println!("{message}");
    }
    fn warn(&self, message: &str) {
        eprintln!("warn: {message}");
    }
    fn error(&self, message: &str) {
        eprintln!("error: {message}");
    }
}