Skip to content

Commit

Permalink
src: print nghttp2 logs when using --debug-nghttp2
Browse files Browse the repository at this point in the history
PR-URL: #45209
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
  • Loading branch information
santigimeno authored and danielleadams committed Dec 28, 2022
1 parent b6077e0 commit 1a1282c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,9 @@
},
],
}],
[ 'debug_nghttp2==1', {
'defines': [ 'NODE_DEBUG_NGHTTP2=1' ]
}],
],
'actions': [
{
Expand Down
10 changes: 10 additions & 0 deletions src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3179,6 +3179,12 @@ void SetCallbackFunctions(const FunctionCallbackInfo<Value>& args) {
#undef SET_FUNCTION
}

#ifdef NODE_DEBUG_NGHTTP2
void NgHttp2Debug(const char* format, va_list args) {
vfprintf(stderr, format, args);
}
#endif

void Http2State::MemoryInfo(MemoryTracker* tracker) const {
tracker->TrackField("root_buffer", root_buffer);
}
Expand Down Expand Up @@ -3344,6 +3350,10 @@ void Initialize(Local<Object> target,
#undef V

target->Set(context, env->constants_string(), constants).Check();

#ifdef NODE_DEBUG_NGHTTP2
nghttp2_set_debug_vprintf_callback(NgHttp2Debug);
#endif
}
} // namespace http2
} // namespace node
Expand Down

0 comments on commit 1a1282c

Please sign in to comment.