diff options
author | Matt Jordan <mjordan@digium.com> | 2016-05-14 07:24:07 -0500 |
---|---|---|
committer | Matt Jordan <mjordan@digium.com> | 2016-05-14 22:44:16 -0500 |
commit | 352237651270c1e766cd7b0eecbf615b495cb833 (patch) | |
tree | 4f9dbaa77d02906a40031f868419085327163bf9 /utils | |
parent | 7643dc44b2879964e895b63ea1b15ed00d201738 (diff) |
logger: Support JSON logging with Verbose messages
When 2d7a4a3357 was merged, it missed the fact that Verbose log messages
are formatted and handled by 'verbosers'. Verbosers are registered
functions that handle verbose messages only; they exist as a separate
class of callbacks. This was done to handle the 'magic' that must be
inserted into Verbose messages sent to remote consoles, so that the
consoles can format the messages correctly, i.e., the leading
tabs/characters.
In reality, verbosers are a weird appendage: they're a separate class of
formatters/message handlers outside of what handles all other log
messages in Asterisk. After some code inspection, it became clear that
simply passing a Verbose message along with its 'sublevel' importance
through the normal logging mechanisms removes the need for verbosers
altogether.
This patch removes the verbosers, and makes the default log formatter
aware that, if the log channel is a console log, it should simply insert
the 'verbose magic' into the log messages itself. This allows the
console handlers to interpret and format the verbose message
themselves.
This simplifies the code quite a lot, and should improve the performance
of printing verbose messages by a reasonable factor:
(1) It removes a number of memory allocations that were done on each
verobse message
(2) It removes the need to strip the verbose magic out of the verbose
log messages before passing them to non-console log channels
(3) It now performs fewer iterations over lists when handling verbose
messages
Since verbose messages are now handled like other log messages (for the
most part), the JSON formatting of the messages works as well.
ASTERISK-25425
Change-Id: I21bf23f0a1e489b5102f8a035fe8871552ce4f96
Diffstat (limited to 'utils')
-rw-r--r-- | utils/extconf.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/utils/extconf.c b/utils/extconf.c index 4eaea3c2d..48053aed6 100644 --- a/utils/extconf.c +++ b/utils/extconf.c @@ -120,9 +120,6 @@ void ast_queue_log(const char *queuename, const char *callid, const char *agent, /* IN CONFLICT: void ast_verbose(const char *fmt, ...) __attribute__((format(printf, 1, 2))); */ -int ast_register_verbose(void (*verboser)(const char *string)); -int ast_unregister_verbose(void (*verboser)(const char *string)); - void ast_console_puts(const char *string); #define _A_ __FILE__, __LINE__, __PRETTY_FUNCTION__ |