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
(cherry picked from commit 56028426de)
This commit is contained in:
Kevin Harwell
2020-08-28 16:32:37 -05:00
parent 0b835f2156
commit e051806e80
11 changed files with 1035 additions and 200 deletions

View File

@@ -52,6 +52,7 @@
#include "asterisk/module.h"
#include "asterisk/paths.h" /* use ast_config_AST_LOG_DIR */
#include "asterisk/logger.h"
#include "asterisk/logger_category.h"
#include "asterisk/lock.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
@@ -1868,6 +1869,8 @@ int init_logger(void)
ast_log(LOG_ERROR, "Errors detected in logger.conf. Default console logging is being used.\n");
}
ast_logger_category_load();
return 0;
}
@@ -1875,6 +1878,8 @@ void close_logger(void)
{
struct logchannel *f = NULL;
ast_logger_category_unload();
ast_cli_unregister_multiple(cli_logger, ARRAY_LEN(cli_logger));
logger_initialized = 0;