Comparison

plugins/mod_admin_shell.lua @ 13352:b1f5a5531564

mod_admin_shell: Remove verbose logging
author Matthew Wild <mwild1@gmail.com>
date Wed, 29 Nov 2023 17:33:56 +0000
parent 13351:e8429d2faea4
child 13354:83f3076965f6
comparison
equal deleted inserted replaced
13351:e8429d2faea4 13352:b1f5a5531564
222 222
223 local line = event.stanza:get_text(); 223 local line = event.stanza:get_text();
224 local useglobalenv; 224 local useglobalenv;
225 225
226 local result = st.stanza("repl-result"); 226 local result = st.stanza("repl-result");
227
228 module:log("warn", "Processing line: %q", line);
229 227
230 if line:match("^>") then 228 if line:match("^>") then
231 line = line:gsub("^>", ""); 229 line = line:gsub("^>", "");
232 useglobalenv = true; 230 useglobalenv = true;
233 else 231 else
2450 2448
2451 local function new_item_handlers(command_host) 2449 local function new_item_handlers(command_host)
2452 local function on_command_added(event) 2450 local function on_command_added(event)
2453 local command = event.item; 2451 local command = event.item;
2454 local mod_name = command._provided_by and ("mod_"..command._provided_by) or "<unknown module>"; 2452 local mod_name = command._provided_by and ("mod_"..command._provided_by) or "<unknown module>";
2455 module:log("warn", "**************************************")
2456 if not schema.validate(command_metadata_schema, command) or type(command.handler) ~= "function" then 2453 if not schema.validate(command_metadata_schema, command) or type(command.handler) ~= "function" then
2457 module:log("warn", "Ignoring command added by %s: missing or invalid data", mod_name); 2454 module:log("warn", "Ignoring command added by %s: missing or invalid data", mod_name);
2458 return; 2455 return;
2459 end 2456 end
2460 2457
2583 end 2580 end
2584 2581
2585 module:handle_items("shell-command", new_item_handlers()); 2582 module:handle_items("shell-command", new_item_handlers());
2586 2583
2587 function module.add_host(host_module) 2584 function module.add_host(host_module)
2588 host_module:log("warn", "Loaded on %s", host_module.host);
2589 host_module:handle_items("shell-command", new_item_handlers(host_module.host)); 2585 host_module:handle_items("shell-command", new_item_handlers(host_module.host));
2590 end 2586 end
2591 2587
2592 function module.unload() 2588 function module.unload()
2593 stanza_watchers.cleanup(); 2589 stanza_watchers.cleanup();