Logging: Add debug logging categories

Added debug logging categories that allow a user to output debug
information based on a specified category. This lets the user limit,
and filter debug output to data relevant to a particular context,
or topic. For instance the following categories are now available for
debug logging purposes:

  dtls, dtls_packet, ice, rtcp, rtcp_packet, rtp, rtp_packet,
  stun, stun_packet

These debug categories can be enable/disable via an Asterisk CLI command.

While this overrides, and outputs debug data, core system debugging is
not affected by this patch. Statements still output at their appropriate
debug level. As well backwards compatibility has been maintained with
past debug groups that could be enabled using the CLI (e.g. rtpdebug,
stundebug, etc.).

ASTERISK-29054 #close

Change-Id: I6e6cb247bb1f01dbf34750b2cd98e5b5b41a1849
This commit is contained in:
Kevin Harwell
2020-08-28 16:32:37 -05:00
committed by George Joseph
parent 51cba591e3
commit 56028426de
11 changed files with 1035 additions and 200 deletions

View File

@@ -3533,6 +3533,55 @@ struct stasis_topic *ast_rtp_topic(void)
return rtp_topic;
}
static uintmax_t debug_category_rtp_id;
uintmax_t ast_debug_category_rtp_id(void)
{
return debug_category_rtp_id;
}
static uintmax_t debug_category_rtp_packet_id;
uintmax_t ast_debug_category_rtp_packet_id(void)
{
return debug_category_rtp_packet_id;
}
static uintmax_t debug_category_rtcp_id;
uintmax_t ast_debug_category_rtcp_id(void)
{
return debug_category_rtcp_id;
}
static uintmax_t debug_category_rtcp_packet_id;
uintmax_t ast_debug_category_rtcp_packet_id(void)
{
return debug_category_rtcp_packet_id;
}
static uintmax_t debug_category_dtls_id;
uintmax_t ast_debug_category_dtls_id(void)
{
return debug_category_dtls_id;
}
static uintmax_t debug_category_dtls_packet_id;
uintmax_t ast_debug_category_dtls_packet_id(void)
{
return debug_category_dtls_packet_id;
}
static uintmax_t debug_category_ice_id;
uintmax_t ast_debug_category_ice_id(void)
{
return debug_category_ice_id;
}
static void rtp_engine_shutdown(void)
{
int x;
@@ -3557,6 +3606,17 @@ static void rtp_engine_shutdown(void)
}
mime_types_len = 0;
ast_rwlock_unlock(&mime_types_lock);
ast_debug_category_unregister(AST_LOG_CATEGORY_ICE);
ast_debug_category_unregister(AST_LOG_CATEGORY_DTLS_PACKET);
ast_debug_category_unregister(AST_LOG_CATEGORY_DTLS);
ast_debug_category_unregister(AST_LOG_CATEGORY_RTCP_PACKET);
ast_debug_category_unregister(AST_LOG_CATEGORY_RTCP);
ast_debug_category_unregister(AST_LOG_CATEGORY_RTP_PACKET);
ast_debug_category_unregister(AST_LOG_CATEGORY_RTP);
}
int ast_rtp_engine_init(void)
@@ -3684,6 +3744,14 @@ int ast_rtp_engine_init(void)
add_static_payload(127, ast_format_slin96, 0);
/* payload types above 127 are not valid */
debug_category_rtp_id = ast_debug_category_register(AST_LOG_CATEGORY_RTP);
debug_category_rtp_packet_id = ast_debug_category_register(AST_LOG_CATEGORY_RTP_PACKET);
debug_category_rtcp_id = ast_debug_category_register(AST_LOG_CATEGORY_RTCP);
debug_category_rtcp_packet_id = ast_debug_category_register(AST_LOG_CATEGORY_RTCP_PACKET);
debug_category_dtls_id = ast_debug_category_register(AST_LOG_CATEGORY_DTLS);
debug_category_dtls_packet_id = ast_debug_category_register(AST_LOG_CATEGORY_DTLS_PACKET);
debug_category_ice_id = ast_debug_category_register(AST_LOG_CATEGORY_ICE);
return 0;
}