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 <rlau@redhat.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
santigimeno authored and danielleadams committed Jan 3, 2023
1 parent 61bc27a commit e05ebe8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions node.gyp
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
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 e05ebe8

Please sign in to comment.