Changeset

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
parents 5323:400ffa842576
children 5325:11b37063d80a
files mod_audit_status/mod_audit_status.lua
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
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);