mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
inspector: log response and requests in the inspector for debugging
Logs the raw messages from the inspector when NODE_DEBUG_NATIVE is set to inspector_server to facilitate debugging. PR-URL: https://github.com/nodejs/node/pull/46941 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
1 parent
77f7200cce
commit
e33dfce401
1 file changed
+10
@@ -248,6 +248,9 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel,
|
||||
|
||||
void dispatchProtocolMessage(const StringView& message) {
|
||||
std::string raw_message = protocol::StringUtil::StringViewToUtf8(message);
|
||||
per_process::Debug(DebugCategory::INSPECTOR_SERVER,
|
||||
"[inspector received] %s\n",
|
||||
raw_message);
|
||||
std::unique_ptr<protocol::DictionaryValue> value =
|
||||
protocol::DictionaryValue::cast(protocol::StringUtil::parseMessage(
|
||||
raw_message, false));
|
||||
@@ -296,6 +299,13 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel,
|
||||
void flushProtocolNotifications() override { }
|
||||
|
||||
void sendMessageToFrontend(const StringView& message) {
|
||||
if (per_process::enabled_debug_list.enabled(
|
||||
DebugCategory::INSPECTOR_SERVER)) {
|
||||
std::string raw_message = protocol::StringUtil::StringViewToUtf8(message);
|
||||
per_process::Debug(DebugCategory::INSPECTOR_SERVER,
|
||||
"[inspector send] %s\n",
|
||||
raw_message);
|
||||
}
|
||||
delegate_->SendMessageToFrontend(message);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user