25 #ifndef _ASTERISK_LOGGER_H
26 #define _ASTERISK_LOGGER_H
30 #if defined(__cplusplus) || defined(c_plusplus)
34 #define EVENTLOG "event_log"
35 #define QUEUELOG "queue_log"
37 #define DEBUG_M(a) { \
41 #define VERBOSE_PREFIX_1 " "
42 #define VERBOSE_PREFIX_2 " == "
43 #define VERBOSE_PREFIX_3 " -- "
44 #define VERBOSE_PREFIX_4 " > "
60 void ast_log(
int level,
const char *file,
int line,
const char *
function,
const char *fmt, ...)
61 __attribute__((
format(printf, 5, 6)));
68 void __attribute__((
format(printf, 5, 6)))
ast_queue_log(const
char *queuename, const
char *callid, const
char *agent, const
char *event, const
char *fmt, ...);
77 void __attribute__((
format(printf, 4, 5)))
__ast_verbose(const
char *file,
int line, const
char *func, const
char *fmt, ...);
79 #define ast_verbose(...) __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__)
81 void __attribute__((
format(printf, 4, 0)))
__ast_verbose_ap(const
char *file,
int line, const
char *func, const
char *fmt, va_list ap);
83 #define ast_verbose_ap(fmt, ap) __ast_verbose_ap(__FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, ap)
116 #define _A_ __FILE__, __LINE__, __PRETTY_FUNCTION__
121 #define __LOG_DEBUG 0
122 #define LOG_DEBUG __LOG_DEBUG, _A_
127 #define AST_LOG_DEBUG __LOG_DEBUG, _A_
132 #define __LOG_NOTICE 2
133 #define LOG_NOTICE __LOG_NOTICE, _A_
135 #ifdef AST_LOG_NOTICE
136 #undef AST_LOG_NOTICE
138 #define AST_LOG_NOTICE __LOG_NOTICE, _A_
143 #define __LOG_WARNING 3
144 #define LOG_WARNING __LOG_WARNING, _A_
146 #ifdef AST_LOG_WARNING
147 #undef AST_LOG_WARNING
149 #define AST_LOG_WARNING __LOG_WARNING, _A_
154 #define __LOG_ERROR 4
155 #define LOG_ERROR __LOG_ERROR, _A_
160 #define AST_LOG_ERROR __LOG_ERROR, _A_
165 #define __LOG_VERBOSE 5
166 #define LOG_VERBOSE __LOG_VERBOSE, _A_
168 #ifdef AST_LOG_VERBOSE
169 #undef AST_LOG_VERBOSE
171 #define AST_LOG_VERBOSE __LOG_VERBOSE, _A_
177 #define LOG_DTMF __LOG_DTMF, _A_
182 #define AST_LOG_DTMF __LOG_DTMF, _A_
184 #define NUMLOGLEVELS 32
229 #define ast_log_dynamic_level(level, ...) ast_log(level, __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__)
236 #define ast_debug(level, ...) do { \
237 if (option_debug >= (level) || (ast_opt_dbg_module && ast_debug_get_by_module(AST_MODULE) >= (level)) ) \
238 ast_log(AST_LOG_DEBUG, __VA_ARGS__); \
241 #define VERBOSITY_ATLEAST(level) (option_verbose >= (level) || (ast_opt_verb_module && ast_verbose_get_by_module(AST_MODULE) >= (level)))
243 #define ast_verb(level, ...) do { \
244 if (VERBOSITY_ATLEAST((level)) ) { \
246 ast_verbose(VERBOSE_PREFIX_4 __VA_ARGS__); \
247 else if (level == 3) \
248 ast_verbose(VERBOSE_PREFIX_3 __VA_ARGS__); \
249 else if (level == 2) \
250 ast_verbose(VERBOSE_PREFIX_2 __VA_ARGS__); \
251 else if (level == 1) \
252 ast_verbose(VERBOSE_PREFIX_1 __VA_ARGS__); \
254 ast_verbose(__VA_ARGS__); \
258 #ifndef _LOGGER_BACKTRACE_H
259 #define _LOGGER_BACKTRACE_H
261 #define AST_MAX_BT_FRAMES 32
315 #if defined(__cplusplus) || defined(c_plusplus)
void ast_console_puts(const char *string)
struct ast_bt * ast_bt_create(void)
unsigned int ast_verbose_get_by_module(const char *module)
Get the verbose level for a module.
void ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt,...)
char ** ast_bt_get_symbols(void **addresses, size_t num_frames)
void ast_console_toggle_loglevel(int fd, int level, int state)
enables or disables logging of a specified level to the console fd specifies the index of the console...
void __ast_verbose(const char *file, int line, const char *func, const char *fmt,...)
This works like ast_log, but prints verbose messages to the console depending on verbosity level set...
void ast_console_toggle_mute(int fd, int silent)
mute or unmute a console from logging
void ast_child_verbose(int level, const char *fmt,...)
void ast_logger_unregister_level(const char *name)
Unregister a previously registered logger level.
int ast_register_verbose(void(*verboser)(const char *string)) attribute_warn_unused_result
int logger_reload(void)
Reload logger without rotating log files.
int ast_logger_register_level(const char *name)
Register a new logger level.
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
#define attribute_warn_unused_result
void ast_console_puts_mutable(const char *string, int level)
log the string to the console, and all attached console clients
void * addresses[AST_MAX_BT_FRAMES]
#define AST_MAX_BT_FRAMES
int ast_bt_get_addresses(struct ast_bt *bt)
Options provided by main asterisk program.
unsigned int ast_debug_get_by_module(const char *module)
Get the debug level for a module.
int ast_unregister_verbose(void(*verboser)(const char *string)) attribute_warn_unused_result
void __ast_verbose_ap(const char *file, int line, const char *func, const char *fmt, va_list ap)
static snd_pcm_format_t format
void * ast_bt_destroy(struct ast_bt *bt)