Add ability for modules to dynamically register logger levels

This patch adds the ability for modules to dynamically create logger levels for their own use; these are named levels just like the built-in levels, and can be directed to any destination that the logger can send any level to, by including their names in logger.conf.

Review: https://reviewboard.asterisk.org/r/244/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194610 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2009-05-15 13:13:47 +00:00
parent 78b84effe3
commit d1e0b11343
3 changed files with 464 additions and 73 deletions

View File

@@ -194,6 +194,37 @@ unsigned int ast_debug_get_by_file(const char *file);
*/
unsigned int ast_verbose_get_by_file(const char *file);
/*!
* \brief Register a new logger level
* \param name The name of the level to be registered
* \retval -1 if an error occurs
* \retval non-zero level to be used with ast_log for sending messages to this level
* \since 1.6.3
*/
int ast_logger_register_level(const char *name);
/*!
* \brief Unregister a previously registered logger level
* \param name The name of the level to be unregistered
* \return nothing
* \since 1.6.3
*/
void ast_logger_unregister_level(const char *name);
/*!
* \brief Send a log message to a dynamically registered log level
* \param level The log level to send the message to
*
* Like ast_log, the log message may include printf-style formats, and
* the data for these must be provided as additional parameters after
* the log message.
*
* \return nothing
* \since 1.6.3
*/
#define ast_log_dynamic_level(level, ...) ast_log(level, __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__)
/*!
* \brief Log a DEBUG message
* \param level The minimum value of option_debug for this message