Mercurial > prosody-hg
comparison plugins/mod_admin_shell.lua @ 14031:0dd917830523
mod_admin_shell: Include timestamps with logs in debug:ping()
Makes it easier to see get a feel for if it pauses on something and how
long things like DNS lookups and connection attempts take.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 06 Jan 2026 19:14:47 +0100 |
| parents | 071779f7645c |
| children | f20bb1c53652 |
comparison
equal
deleted
inserted
replaced
| 14030:0afcbea41f22 | 14031:0dd917830523 |
|---|---|
| 18 local it = require "prosody.util.iterators"; | 18 local it = require "prosody.util.iterators"; |
| 19 local server = require "prosody.net.server"; | 19 local server = require "prosody.net.server"; |
| 20 local schema = require "prosody.util.jsonschema"; | 20 local schema = require "prosody.util.jsonschema"; |
| 21 local st = require "prosody.util.stanza"; | 21 local st = require "prosody.util.stanza"; |
| 22 local parse_args = require "prosody.util.argparse".parse; | 22 local parse_args = require "prosody.util.argparse".parse; |
| 23 local dt = require "prosody.util.datetime"; | |
| 23 | 24 |
| 24 local _G = _G; | 25 local _G = _G; |
| 25 | 26 |
| 26 local prosody = _G.prosody; | 27 local prosody = _G.prosody; |
| 27 | 28 |
| 2531 | 2532 |
| 2532 local writing = false; | 2533 local writing = false; |
| 2533 local sink = logger.add_simple_sink(function (source, level, message) | 2534 local sink = logger.add_simple_sink(function (source, level, message) |
| 2534 if writing then return; end | 2535 if writing then return; end |
| 2535 writing = true; | 2536 writing = true; |
| 2536 print(source, level, message); | 2537 print(dt.time(time.now()), source, level, message); |
| 2537 writing = false; | 2538 writing = false; |
| 2538 end); | 2539 end); |
| 2539 | 2540 |
| 2540 return module:context(localhost):send_iq(iq, nil, timeout):finally(function() | 2541 return module:context(localhost):send_iq(iq, nil, timeout):finally(function() |
| 2541 if not logger.remove_sink(sink) then | 2542 if not logger.remove_sink(sink) then |
