Fyi, I created a quick capture node --> capture debug node. It generates a msg for each debug message generated. It also implements some basic logic to avoid endless loops if a debug node is attached to it.

As shown, it also captures error and info messages in the debug.
How does it do this?
The core of the node is this:
module.exports = function(RED) {
function Corecapture_debugFunctionality(config) {
RED.nodes.createNode(this,config);
var node = this;
var cfg = config;
var handler = (msg) => {
if (msg.topic != "debug") { return }
if (!msg.data || typeof msg.data != "object") { return }
// ignore any debug messages generated by debug nodes directly connected
// to this node else endless loops are created.
if (node.wires[0].indexOf(msg.data.id) > -1) { return }
if ( msg.data.format == "Object") {
let d = JSON.parse(msg.data.msg)
if (d._capturedebug) { return }
}
if (msg.topic == "debug" && ( (msg.data && !msg.data._capturedebug) || !msg._capturedebug )) {
node.send({
_capturedebug: node.id,
_msgid: RED.util.generateId(),
debug: msg.data
})
}
}
require("@node-red/util").events.on('comms', handler)
node.on('close', function() {
require("@node-red/util").events.off("comms", handler)
});
}
RED.nodes.registerType("capture-debug", Corecapture_debugFunctionality);
}