aboutsummaryrefslogtreecommitdiffstats
path: root/util/format.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-03-26 00:18:05 +0100
committerKim Alvefur <zash@zash.se>2023-03-26 00:18:05 +0100
commit328447c2b1cb81e68b64aeb5b5d1931fabfb178f (patch)
tree42cd670e17dadcd8b61dd40decbb4faa5e855a0c /util/format.lua
parent026b2d6e88a5c6c9f8766cb9776fa54b7b18b0f8 (diff)
downloadprosody-328447c2b1cb81e68b64aeb5b5d1931fabfb178f.tar.gz
prosody-328447c2b1cb81e68b64aeb5b5d1931fabfb178f.zip
util.format: Tweak serialization of %q formatted entries
Improves serialization of function references especially, the built-in default handling of that in util.serialization is not the most informative. Now, along with the function metatable from util.startup, the actual function can be found by filename and line number.
Diffstat (limited to 'util/format.lua')
-rw-r--r--util/format.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/util/format.lua b/util/format.lua
index caeada63..e07f5f2f 100644
--- a/util/format.lua
+++ b/util/format.lua
@@ -10,7 +10,14 @@ local unpack = table.unpack;
local pack = table.pack;
local valid_utf8 = require "prosody.util.encodings".utf8.valid;
local type = type;
-local dump = require "prosody.util.serialization".new("debug");
+local dump = require"prosody.util.serialization".new({
+ preset = "compact";
+ fallback = function(v, why)
+ return "_[[" .. (why or tostring(v)) .. "]] ";
+ end;
+ fatal = false;
+ maxdepth = 5;
+});
local num_type = math.type;
-- In Lua 5.3+ these formats throw an error if given a float