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.

Changes between revision 1 and 2

1 2 3 4
1 2 3 4

  1. /trunk/include/asterisk/logger.h: Loading...
  2. /trunk/main/logger.c: Loading...
/trunk/include/asterisk/logger.h
Diff Revision 1 Diff Revision 2
[20] 208 lines
[+20] [+] int ast_logger_register_level(const char *name);
209
 * \return nothing
209
 * \return nothing
210
 * \since 1.6.3
210
 * \since 1.6.3
211
 */
211
 */
212
void ast_logger_unregister_level(const char *name);
212
void ast_logger_unregister_level(const char *name);
213

    
   
213

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

    
   
215
 * \brief Send a log message to a dynamically registered log level

    
   
216
 * \param level The log level to send the message to

    
   
217
 *

    
   
218
 * Like ast_log, the log message may include printf-style formats, and

    
   
219
 * the data for these must be provided as additional parameters after

    
   
220
 * the log message.

    
   
221
 *

    
   
222
 * \return nothing

    
   
223
 * \since 1.6.3

    
   
224
 */

    
   
225

   

    
   
226
#define ast_log_dynamic_level(level, ...) ast_log(level, __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__)
215

    
   
227

   
216
/*!
228
/*!
217
 * \brief Log a DEBUG message
229
 * \brief Log a DEBUG message
218
 * \param level The minimum value of option_debug for this message
230
 * \param level The minimum value of option_debug for this message
219
 *        to get logged
231
 *        to get logged
[+20] [20] 75 lines
/trunk/main/logger.c
Diff Revision 1 Diff Revision 2
 
  1. /trunk/include/asterisk/logger.h: Loading...
  2. /trunk/main/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.