Software /
code /
prosody
Changeset
12167:03f551510b1e
migrator: Enhance logging
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 09 Jan 2022 16:35:43 +0100 |
parents | 12166:39483b4099b4 |
children | 12168:33e856c65033 |
files | tools/migration/prosody-migrator.lua |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/migration/prosody-migrator.lua Sun Jan 09 16:08:15 2022 +0100 +++ b/tools/migration/prosody-migrator.lua Sun Jan 09 16:35:43 2022 +0100 @@ -150,8 +150,10 @@ local function users(store, host) if store.users then + log("debug", "Using store user iterator") return store:users(); else + log("debug", "Using usermanagre user iterator") return um.users(host); end end @@ -186,12 +188,16 @@ if options["keep-going"] then local xpcall = require "util.xpcall".xpcall; - local function log_err(err) - log("error", "Error migrating data: %s", err); - log("debug", "%s", debug.traceback()); - end for t, f in pairs(migrate_once) do migrate_once[t] = function (origin, destination, user) + local function log_err(err) + if user then + log("error", "Error migrating data for user %q: %s", user, err); + else + log("error", "Error migrating data for host: %s", err); + end + log("debug", "%s", debug.traceback(nil, 2)); + end xpcall(f, log_err, origin, destination, user); end end @@ -220,6 +226,7 @@ migrate(origin, destination, nil); -- host data for user in users(origin, host) do + log("info", "Migrating user %s@%s store %s (%s)", user, host, store, typ); migrate(origin, destination, user); end end