Review Board 1.7.16


Add ability for modules to dynamically register/unregister logger levels

Review Request #244 - Created May 4, 2009 and submitted

Kevin Fleming
trunk
Reviewers
asterisk-dev
Asterisk
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.
Tested using included test_logger module.

Diff revision 1

This is not the most recent revision of the diff. The latest diff is revision 4. See what's changed.

1 2 3 4
1 2 3 4

  1. /trunk/include/asterisk/logger.h: Loading...
  2. /trunk/main/logger.c: Loading...
  3. /trunk/tests/test_logger.c: Loading...
/trunk/include/asterisk/logger.h
Revision 191995 New Change
[20] 192 lines
[+20] [+] unsigned int ast_debug_get_by_file(const char *file);
193
 * \return the debug level
193
 * \return the debug level
194
 */
194
 */
195
unsigned int ast_verbose_get_by_file(const char *file);
195
unsigned int ast_verbose_get_by_file(const char *file);
196

    
   
196

   
197
/*!
197
/*!

    
   
198
 * \brief Register a new logger level

    
   
199
 * \param name The name of the level to be registered

    
   
200
 * \retval -1 if an error occurs

    
   
201
 * \retval non-zero level to be used with ast_log for sending messages to this level

    
   
202
 * \since 1.6.3

    
   
203
 */

    
   
204
int ast_logger_register_level(const char *name);

    
   
205

   

    
   
206
/*!

    
   
207
 * \brief Unregister a previously registered logger level

    
   
208
 * \param name The name of the level to be unregistered

    
   
209
 * \return nothing

    
   
210
 * \since 1.6.3

    
   
211
 */

    
   
212
void ast_logger_unregister_level(const char *name);

    
   
213

   

    
   
214
#define ast_log_dynamic_level(a, ...) ast_log(a, __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__)

    
   
215

   

    
   
216
/*!
198
 * \brief Log a DEBUG message
217
 * \brief Log a DEBUG message
199
 * \param level The minimum value of option_debug for this message
218
 * \param level The minimum value of option_debug for this message
200
 *        to get logged
219
 *        to get logged
201
 */
220
 */
202
#define ast_debug(level, ...) do {       \
221
#define ast_debug(level, ...) do {       \
[+20] [20] 73 lines
/trunk/main/logger.c
Revision 191995 New Change
 
/trunk/tests/test_logger.c
New File
 
  1. /trunk/include/asterisk/logger.h: Loading...
  2. /trunk/main/logger.c: Loading...
  3. /trunk/tests/test_logger.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.