package cmd

import (
	"fmt"
	"os"

	"skraak/db"
)

// initEventLog configures transaction event logging for the given database path.
// Returns a cleanup function that should be deferred by the caller.
func initEventLog(dbPath string) func() {
	db.SetEventLogConfig(db.EventLogConfig{
		Enabled: true,
		Path:    dbPath + ".events.jsonl",
	})
	return func() {
		if err := db.CloseEventLog(); err != nil {
			fmt.Fprintf(os.Stderr, "Warning: failed to close event log: %v\n", err)
		}
	}
}