Commits

Daniel Poelzleithner committed 0b7e87f

add trace.debug_traceback() function

It inserts a traceback into the trace debug log. Usefull on development of unknown code.

Comments (0)

Files changed (2)

framework/env/trace/_render_sub_tree.lua

     open("debug")
     slot.put(encode.html(node.message))
     close()
+  elseif node_type == "traceback" then
+    open("debug")
+    slot.put('<pre>')
+    slot.put(encode.html(node.message))
+    slot.put('</pre>')
+    close()
   elseif node_type == "request" then
     open("request")
     open_head()

framework/env/trace/debug_trace.lua

+--[[--
+trace.debug_trace(
+  message     -- optional message to add
+)
+
+This function includes a traceback into the debugging log
+
+--]]--
+
+function trace.debug_trace(message)
+  trace._new_entry{ type = "traceback", message = tostring(debug.traceback(message or "", 2)) }
+end