![]() |
Home page |
Mailing list |
Docs
Asterisk developer's documentation :: Codename Pineapple
logger.h File Reference
Definition in file logger.h.
#include "asterisk/compat.h"
#include <stdarg.h>
Include dependency graph for logger.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Defines | |
| #define | __LOG_DEBUG 0 |
| #define | __LOG_DTMF 6 |
| #define | __LOG_ERROR 4 |
| #define | __LOG_EVENT 1 |
| #define | __LOG_NOTICE 2 |
| #define | __LOG_VERBOSE 5 |
| #define | __LOG_WARNING 3 |
| #define | _A_ __FILE__, __LINE__, __PRETTY_FUNCTION__ |
| #define | DEBUG_M(a) |
| #define | EVENTLOG "event_log" |
| #define | LOG_DEBUG __LOG_DEBUG, _A_ |
| #define | LOG_DTMF __LOG_DTMF, _A_ |
| #define | LOG_ERROR __LOG_ERROR, _A_ |
| #define | LOG_EVENT __LOG_EVENT, _A_ |
| #define | LOG_NOTICE __LOG_NOTICE, _A_ |
| #define | LOG_VERBOSE __LOG_VERBOSE, _A_ |
| #define | LOG_WARNING __LOG_WARNING, _A_ |
| #define | QUEUELOG "queue_log" |
| #define | VERBOSE_PREFIX_1 " " |
| #define | VERBOSE_PREFIX_2 " == " |
| #define | VERBOSE_PREFIX_3 " -- " |
| #define | VERBOSE_PREFIX_4 " > " |
Functions | |
| void void | ast_backtrace (void) |
| void | ast_console_puts (const char *string) |
| void | ast_console_puts_mutable (const char *string) |
| log the string to the console, and all attached console clients | |
| void | ast_console_toggle_mute (int fd) |
| mute or unmute a console from logging | |
| void | ast_log (int level, const char *file, int line, const char *function, const char *fmt,...) __attribute__((format(printf |
| This is the standard logger function. Probably the only way you will invoke it would be something like this: ast_log(LOG_WHATEVER, "Problem with the %s Captain. We should get some more. Will %d be enough?\n", "flux capacitor", 10); where WHATEVER is one of ERROR, DEBUG, EVENT, NOTICE, or WARNING depending on which log you wish to output to. These are implemented as macros, that will provide the function with the needed arguments. | |
| void | ast_queue_log (const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt,...) __attribute__((format(printf |
| void void int | ast_register_verbose (void(*verboser)(const char *string)) |
| int | ast_unregister_verbose (void(*verboser)(const char *string)) |
| void void | ast_verbose (const char *fmt,...) __attribute__((format(printf |
| This works like ast_log, but prints verbose messages to the console depending on verbosity level set. ast_verbose(VERBOSE_PREFIX_3 "Whatever %s is happening\n", "nothing"); This will print the message to the console if the verbose level is set to a level >= 3 Note the abscence of a comma after the VERBOSE_PREFIX_3. This is important. VERBOSE_PREFIX_1 through VERBOSE_PREFIX_3 are defined. | |
|
|
Definition at line 93 of file logger.h. Referenced by ast_log(), ast_log_vsyslog(), handle_logger_show_channels(), and make_components(). |
|
|
Definition at line 129 of file logger.h. Referenced by ast_log_vsyslog(), handle_logger_show_channels(), and make_components(). |
|
|
Definition at line 117 of file logger.h. Referenced by handle_logger_show_channels(), and make_components(). |
|
|
Definition at line 99 of file logger.h. Referenced by handle_logger_show_channels(), logger_print_normal(), and make_components(). |
|
|
Definition at line 105 of file logger.h. Referenced by handle_logger_show_channels(), and make_components(). |
|
|
Definition at line 123 of file logger.h. Referenced by ast_log(), ast_log_vsyslog(), handle_logger_show_channels(), logger_print_normal(), and make_components(). |
|
|
Definition at line 111 of file logger.h. Referenced by handle_logger_show_channels(), and make_components(). |
|
|
|
|
|
Value: { \
a; \
}
|
|
|
Definition at line 36 of file logger.h. Referenced by init_logger(). |
|
|
|
Definition at line 130 of file logger.h. Referenced by __ast_read(), __oh323_update_info(), oh323_digit_begin(), oh323_digit_end(), oh323_rtp_read(), and receive_digit(). |
|
|
|
Definition at line 100 of file logger.h. Referenced by action_login(), attempt_thread(), init_logger(), logger_print_normal(), and scan_service(). |
|
|
|
Definition at line 124 of file logger.h. Referenced by transmit_response(), and unload_module(). |
|
|
|
|
|
|
Definition at line 43 of file logger.h. Referenced by cb_extensionstate(), console_verboser(), do_monitor(), do_sip_monitor(), handle_verbose(), load_module(), load_pbx(), load_resource(), reload(), unload_module(), and zap_restart(). |
|
|
|
|
Definition at line 46 of file logger.h. Referenced by ast_dnsmgr_lookup(), ast_dnsmgr_release(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_pbx_run_app(), config_odbc_prepare(), console_verboser(), handle_verbose(), and socket_process(). |
|
|
Definition at line 955 of file logger.c. References ast_calloc, ast_log(), free, and option_debug. 00956 { 00957 #ifdef STACK_BACKTRACES 00958 int count=0, i=0; 00959 void **addresses; 00960 char **strings; 00961 00962 if ((addresses = ast_calloc(MAX_BACKTRACE_FRAMES, sizeof(*addresses)))) { 00963 count = backtrace(addresses, MAX_BACKTRACE_FRAMES); 00964 if ((strings = backtrace_symbols(addresses, count))) { 00965 if (option_debug) 00966 ast_log(LOG_DEBUG, "Got %d backtrace record%c\n", count, count != 1 ? 's' : ' '); 00967 for (i=0; i < count ; i++) { 00968 if (option_debug) 00969 ast_log(LOG_DEBUG, "#%d: [%08X] %s\n", i, (unsigned int)addresses[i], strings[i]); 00970 } 00971 free(strings); 00972 } else { 00973 if (option_debug) 00974 ast_log(LOG_DEBUG, "Could not allocate memory for backtrace\n"); 00975 } 00976 free(addresses); 00977 } 00978 #else 00979 #ifdef Linux 00980 ast_log(LOG_WARNING, "Must compile with 'make dont-optimize' for stack backtraces\n"); 00981 #else 00982 ast_log(LOG_WARNING, "Inline stack backtraces are only available on the Linux platform.\n"); 00983 #endif 00984 #endif 00985 }
|
|
|
write the string to the console, and all attached console clients Definition at line 757 of file asterisk.c. References ast_network_puts(). Referenced by chan_misdn_log(). 00758 { 00759 fputs(string, stdout); 00760 fflush(stdout); 00761 ast_network_puts(string); 00762 }
|
|
|
log the string to the console, and all attached console clients
Definition at line 734 of file asterisk.c. References ast_network_puts_mutable(). Referenced by logger_print_normal(). 00735 { 00736 fputs(string, stdout); 00737 fflush(stdout); 00738 ast_network_puts_mutable(string); 00739 }
|
|
|
mute or unmute a console from logging
Definition at line 699 of file asterisk.c. References ast_cli(), AST_MAX_CONNECTS, and consoles. Referenced by handle_logger_mute(). 00699 { 00700 int x; 00701 for (x = 0;x < AST_MAX_CONNECTS; x++) { 00702 if (fd == consoles[x].fd) { 00703 if (consoles[x].mute) { 00704 consoles[x].mute = 0; 00705 ast_cli(fd, "Console is not muted anymore.\n"); 00706 } else { 00707 consoles[x].mute = 1; 00708 ast_cli(fd, "Console is muted.\n"); 00709 } 00710 return; 00711 } 00712 } 00713 ast_cli(fd, "Couldn't find remote console.\n"); 00714 }
|
|
||||||||||||||||||||||||||||
|
This is the standard logger function. Probably the only way you will invoke it would be something like this: ast_log(LOG_WHATEVER, "Problem with the %s Captain. We should get some more. Will %d be enough?\n", "flux capacitor", 10); where WHATEVER is one of ERROR, DEBUG, EVENT, NOTICE, or WARNING depending on which log you wish to output to. These are implemented as macros, that will provide the function with the needed arguments.
|
|
||||||||||||||||||||||||||||
|
|
|
|
Definition at line 1040 of file logger.c. References AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_malloc, and verb. Referenced by ast_makesocket(), and show_console(). 01041 { 01042 struct verb *verb; 01043 01044 if (!(verb = ast_malloc(sizeof(*verb)))) 01045 return -1; 01046 01047 verb->verboser = v; 01048 01049 AST_LIST_LOCK(&verbosers); 01050 AST_LIST_INSERT_HEAD(&verbosers, verb, list); 01051 AST_LIST_UNLOCK(&verbosers); 01052 01053 return 0; 01054 }
|
|
|
Definition at line 1056 of file logger.c. References AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, free, and verb::verboser. Referenced by exit_now(). 01057 { 01058 struct verb *cur; 01059 01060 AST_LIST_LOCK(&verbosers); 01061 AST_LIST_TRAVERSE_SAFE_BEGIN(&verbosers, cur, list) { 01062 if (cur->verboser == v) { 01063 AST_LIST_REMOVE_CURRENT(&verbosers, list); 01064 free(cur); 01065 break; 01066 } 01067 } 01068 AST_LIST_TRAVERSE_SAFE_END 01069 AST_LIST_UNLOCK(&verbosers); 01070 01071 return cur ? 0 : -1; 01072 }
|
|
||||||||||||
|
This works like ast_log, but prints verbose messages to the console depending on verbosity level set. ast_verbose(VERBOSE_PREFIX_3 "Whatever %s is happening\n", "nothing"); This will print the message to the console if the verbose level is set to a level >= 3 Note the abscence of a comma after the VERBOSE_PREFIX_3. This is important. VERBOSE_PREFIX_1 through VERBOSE_PREFIX_3 are defined. Send a verbose message (based on verbose level) |