Diff

mod_audit_status/mod_audit_status.lua @ 5324:18fd615c2733

mod_audit_status: Include shutdown reason in log entry
author Matthew Wild <mwild1@gmail.com>
date Fri, 07 Apr 2023 13:10:43 +0100
parent 5320:c450dbf6c0fa
child 5353:14b6397cd6de
line wrap: on
line diff
--- a/mod_audit_status/mod_audit_status.lua	Fri Apr 07 13:10:20 2023 +0100
+++ b/mod_audit_status/mod_audit_status.lua	Fri Apr 07 13:10:43 2023 +0100
@@ -1,5 +1,7 @@
 module:depends("audit");
 
+local st = require "util.stanza";
+
 -- Suppress warnings about module:audit()
 -- luacheck: ignore 143/module
 
@@ -17,7 +19,11 @@
 end);
 
 module:hook_global("server-stopped", function ()
-	module:audit(nil, "server-stopped");
+	module:audit(nil, "server-stopped", {
+		custom = {
+			prosody.shutdown_reason and st.stanza("note"):text(prosody.shutdown_reason);
+		};
+	});
 	store:set_key(nil, "status", "stopped");
 end);