Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Support for logging to various files, console and syslog Configuration in file logger.conf. More...
#include "asterisk/options.h"
Go to the source code of this file.
Macros | |
#define | __LOG_DEBUG 0 |
#define | __LOG_DTMF 6 |
#define | __LOG_ERROR 4 |
#define | __LOG_NOTICE 2 |
#define | __LOG_TRACE 1 |
#define | __LOG_VERBOSE 5 |
#define | __LOG_WARNING 3 |
#define | _A_ __FILE__, __LINE__, __FUNCTION__ |
#define | _TRACE_PREFIX_ _TRACE_PREFIX_DEFAULT_ |
#define | _TRACE_PREFIX_DEFAULT_ _A_ |
#define | AST_CALLID_BUFFER_LENGTH 13 |
#define | ast_debug(level, ...) |
Log a DEBUG message. More... | |
#define | AST_LOG_DEBUG __LOG_DEBUG, _A_ |
#define | AST_LOG_DTMF __LOG_DTMF, _A_ |
#define | ast_log_dynamic_level(level, ...) ast_log(level, _A_, __VA_ARGS__) |
Send a log message to a dynamically registered log level. More... | |
#define | AST_LOG_ERROR __LOG_ERROR, _A_ |
#define | AST_LOG_NOTICE __LOG_NOTICE, _A_ |
#define | AST_LOG_TRACE __LOG_TRACE, _A_ |
#define | AST_LOG_VERBOSE __LOG_VERBOSE, _A_ |
#define | AST_LOG_WARNING __LOG_WARNING, _A_ |
#define | ast_trace(level, ...) ast_debug(level < 0 ? __scope_level : level, " " __VA_ARGS__) |
#define | ast_trace_dec_indent() |
#define | ast_trace_get_indent() (0) |
#define | ast_trace_inc_indent() |
#define | ast_trace_log(__level, __log_level, ...) |
#define | ast_trace_raw(level, indent_type, ...) ast_debug(level < 0 ? __scope_level : level, " " __VA_ARGS__) |
#define | ast_trace_set_indent(indent) |
#define | ast_verb(level, ...) |
#define | ast_verb_callid(level, callid, ...) |
#define | ast_verbose(...) __ast_verbose(_A_, -1, __VA_ARGS__) |
#define | ast_verbose_callid(callid, ...) __ast_verbose_callid(_A_, -1, callid, __VA_ARGS__) |
#define | DEBUG_ATLEAST(level) |
#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_NOTICE __LOG_NOTICE, _A_ |
#define | LOG_TRACE __LOG_TRACE, _A_ |
#define | LOG_VERBOSE __LOG_VERBOSE, _A_ |
#define | LOG_WARNING __LOG_WARNING, _A_ |
#define | NUMLOGLEVELS 32 |
#define | QUEUELOG "queue_log" |
#define | SCOPE_CALL(level, __funcname, ...) __funcname(__VA_ARGS__) |
#define | SCOPE_CALL_WITH_INT_RESULT(level, __funcname, ...) __funcname(__VA_ARGS__) |
#define | SCOPE_CALL_WITH_RESULT(level, __var, __funcname, ...) __var = __funcname(__VA_ARGS__) |
#define | SCOPE_ENTER(level, ...) |
#define | SCOPE_ENTER_TASK(level, indent, ...) |
#define | SCOPE_EXIT(...) ast_debug(__scope_level, " " __VA_ARGS__) |
#define | SCOPE_EXIT_EXPR(__expr, ...) |
#define | SCOPE_EXIT_LOG(__log_level, ...) |
#define | SCOPE_EXIT_LOG_EXPR(__expr, __log_level, ...) |
#define | SCOPE_EXIT_LOG_RTN(__log_level, ...) |
#define | SCOPE_EXIT_LOG_RTN_VALUE(__value, __log_level, ...) |
#define | SCOPE_EXIT_RTN(...) |
#define | SCOPE_EXIT_RTN_VALUE(__return_value, ...) |
#define | SCOPE_TRACE(__level, ...) |
#define | TRACE_ATLEAST(level) |
#define | VERBOSE_HASMAGIC(x) (*(signed char *) (x) < 0) |
#define | VERBOSE_MAGIC2LEVEL(x) (((char) -*(signed char *) (x)) - 1) |
#define | VERBOSE_PREFIX_1 " " |
#define | VERBOSE_PREFIX_10 " > " |
#define | VERBOSE_PREFIX_2 " == " |
#define | VERBOSE_PREFIX_3 " -- " |
#define | VERBOSE_PREFIX_4 " > " |
#define | VERBOSE_PREFIX_5 " > " |
#define | VERBOSE_PREFIX_6 " > " |
#define | VERBOSE_PREFIX_7 " > " |
#define | VERBOSE_PREFIX_8 " > " |
#define | VERBOSE_PREFIX_9 " > " |
#define | VERBOSITY_ATLEAST(level) ((level) <= ast_verb_sys_level) |
Typedefs | |
typedef unsigned int | ast_callid |
Enumerations | |
enum | ast_logger_results { AST_LOGGER_SUCCESS = 0 , AST_LOGGER_FAILURE = 1 , AST_LOGGER_DECLINE = -1 , AST_LOGGER_ALLOC_ERROR = -2 } |
enum | ast_trace_indent_type { AST_TRACE_INDENT_SAME = 0 , AST_TRACE_INDENT_INC_BEFORE , AST_TRACE_INDENT_INC_AFTER , AST_TRACE_INDENT_DEC_BEFORE , AST_TRACE_INDENT_DEC_AFTER , AST_TRACE_INDENT_PROVIDED , AST_TRACE_INDENT_NONE } |
Controls if and when indenting is applied. More... | |
Functions | |
void | __ast_verbose (const char *file, int line, const char *func, int level, const char *fmt,...) |
Send a verbose message (based on verbose level) More... | |
void | __ast_verbose_ap (const char *file, int line, const char *func, int level, ast_callid callid, const char *fmt, va_list ap) |
void | __ast_verbose_callid (const char *file, int line, const char *func, int level, ast_callid callid, const char *fmt,...) |
Send a verbose message (based on verbose level) with deliberately specified callid. More... | |
void | ast_callid_strnprint (char *buffer, size_t buffer_size, ast_callid callid) |
copy a string representation of the callid into a target string More... | |
int | ast_callid_threadassoc_add (ast_callid callid) |
Adds a known callid to thread storage of the calling thread. More... | |
int | ast_callid_threadassoc_change (ast_callid callid) |
Sets what is stored in the thread storage to the given callid if it does not match what is already there. More... | |
int | ast_callid_threadassoc_remove (void) |
Removes callid from thread storage of the calling thread. More... | |
int | ast_callid_threadstorage_auto (ast_callid *callid) |
Checks thread storage for a callid and stores a reference if it exists. If not, then a new one will be created, bound to the thread, and a reference to it will be stored. More... | |
void | ast_callid_threadstorage_auto_clean (ast_callid callid, int callid_created) |
Use in conjunction with ast_callid_threadstorage_auto. Cleans up the references and if the callid was created by threadstorage_auto, unbinds the callid from the threadstorage. More... | |
void | ast_child_verbose (int level, const char *fmt,...) |
void | ast_console_puts (const char *string) |
write the string to the root console, and all attached network console clients More... | |
void | ast_console_puts_mutable (const char *string, int level) |
log the string to the console, and all attached console clients More... | |
void | ast_console_puts_mutable_full (const char *message, int level, int sublevel) |
log the string to the console, and all attached console clients More... | |
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 receiving the level change level specifies the index of the logging level being toggled state indicates whether logging will be on or off (0 for off, 1 for on) More... | |
void | ast_console_toggle_mute (int fd, int silent) |
mute or unmute a console from logging More... | |
ast_callid | ast_create_callid (void) |
factory function to create a new uniquely identifying callid. More... | |
unsigned int | ast_debug_get_by_module (const char *module) |
Get the debug level for a module. More... | |
void | ast_init_logger_for_socket_console (void) |
load logger.conf configuration for console socket connections More... | |
int | ast_is_logger_initialized (void) |
Test if logger is initialized. More... | |
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 invoke it would be something like this: ast_log(AST_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. More... | |
void | ast_log_ap (int level, const char *file, int line, const char *function, const char *fmt, va_list ap) |
void | ast_log_backtrace (void) |
Log a backtrace of the current thread's execution stack to the Asterisk log. More... | |
void | ast_log_callid (int level, const char *file, int line, const char *function, ast_callid callid, const char *fmt,...) |
Used for sending a log message with a known call_id This is a modified logger function which is functionally identical to the above logger function, it just include a call_id argument as well. If NULL is specified here, no attempt will be made to join the log message with a call_id. More... | |
void | ast_log_safe (int level, const char *file, int line, const char *function, const char *fmt,...) |
Used for sending a log message with protection against recursion. More... | |
int | ast_logger_create_channel (const char *log_channel, const char *components) |
Create a log channel. More... | |
int | ast_logger_get_channels (int(*logentry)(const char *channel, const char *type, const char *status, const char *configuration, void *data), void *data) |
Retrieve the existing log channels. More... | |
const char * | ast_logger_get_dateformat (void) |
Get the logger configured date format. More... | |
int | ast_logger_get_dynamic_level (const char *name) |
Retrieve dynamic logging level id. More... | |
int | ast_logger_get_queue_limit (void) |
Get the maximum number of messages allowed in the processing queue. More... | |
int | ast_logger_register_level (const char *name) |
Register a new logger level. More... | |
int | ast_logger_remove_channel (const char *log_channel) |
Delete the specified log channel. More... | |
int | ast_logger_rotate (void) |
Reload logger while rotating log files. More... | |
int | ast_logger_rotate_channel (const char *log_channel) |
Rotate the specified log channel. More... | |
void | ast_logger_set_queue_limit (int queue_limit) |
Set the maximum number of messages allowed in the processing queue. More... | |
void | ast_logger_unregister_level (const char *name) |
Unregister a previously registered logger level. More... | |
void | ast_queue_log (const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt,...) |
ast_callid | ast_read_threadstorage_callid (void) |
extracts the callerid from the thread More... | |
int | ast_register_verbose (void(*verboser)(const char *string)) attribute_warn_unused_result |
unsigned int | ast_trace_get_by_module (const char *module) |
Get the trace level for a module. More... | |
int | ast_unregister_verbose (void(*verboser)(const char *string)) attribute_warn_unused_result |
int | ast_verb_console_get (void) |
Get this thread's console verbosity level. More... | |
void | ast_verb_console_register (int *level) |
Register this thread's console verbosity level pointer. More... | |
void | ast_verb_console_set (int verb_level) |
Set this thread's console verbosity level. More... | |
void | ast_verb_console_unregister (void) |
Unregister this thread's console verbosity level. More... | |
void | ast_verb_update (void) |
Re-evaluate the system max verbosity level (ast_verb_sys_level). More... | |
Variables | |
int | ast_verb_sys_level |
Support for logging to various files, console and syslog Configuration in file logger.conf.
Definition in file include/asterisk/logger.h.
#define __LOG_DEBUG 0 |
Definition at line 247 of file include/asterisk/logger.h.
#define __LOG_DTMF 6 |
Definition at line 313 of file include/asterisk/logger.h.
#define __LOG_ERROR 4 |
Definition at line 291 of file include/asterisk/logger.h.
#define __LOG_NOTICE 2 |
Definition at line 269 of file include/asterisk/logger.h.
#define __LOG_TRACE 1 |
Definition at line 258 of file include/asterisk/logger.h.
#define __LOG_VERBOSE 5 |
Definition at line 302 of file include/asterisk/logger.h.
#define __LOG_WARNING 3 |
Definition at line 280 of file include/asterisk/logger.h.
#define _A_ __FILE__, __LINE__, __FUNCTION__ |
Definition at line 42 of file include/asterisk/logger.h.
#define AST_CALLID_BUFFER_LENGTH 13 |
Definition at line 55 of file include/asterisk/logger.h.
#define ast_debug | ( | level, | |
... | |||
) |
Log a DEBUG message.
level | The minimum value of option_debug for this message to get logged |
Definition at line 457 of file include/asterisk/logger.h.
#define AST_LOG_DEBUG __LOG_DEBUG, _A_ |
Definition at line 253 of file include/asterisk/logger.h.
#define AST_LOG_DTMF __LOG_DTMF, _A_ |
Definition at line 319 of file include/asterisk/logger.h.
Send a log message to a dynamically registered log level.
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.
Definition at line 444 of file include/asterisk/logger.h.
#define AST_LOG_ERROR __LOG_ERROR, _A_ |
Definition at line 297 of file include/asterisk/logger.h.
#define AST_LOG_NOTICE __LOG_NOTICE, _A_ |
Definition at line 275 of file include/asterisk/logger.h.
#define AST_LOG_TRACE __LOG_TRACE, _A_ |
Definition at line 264 of file include/asterisk/logger.h.
#define AST_LOG_VERBOSE __LOG_VERBOSE, _A_ |
Definition at line 308 of file include/asterisk/logger.h.
#define AST_LOG_WARNING __LOG_WARNING, _A_ |
Definition at line 286 of file include/asterisk/logger.h.
#define ast_verb | ( | level, | |
... | |||
) |
Definition at line 468 of file include/asterisk/logger.h.
#define ast_verb_callid | ( | level, | |
callid, | |||
... | |||
) |
Definition at line 475 of file include/asterisk/logger.h.
#define ast_verbose | ( | ... | ) | __ast_verbose(_A_, -1, __VA_ARGS__) |
Definition at line 186 of file include/asterisk/logger.h.
#define ast_verbose_callid | ( | callid, | |
... | |||
) | __ast_verbose_callid(_A_, -1, callid, __VA_ARGS__) |
Definition at line 187 of file include/asterisk/logger.h.
#define DEBUG_ATLEAST | ( | level | ) |
Definition at line 446 of file include/asterisk/logger.h.
#define DEBUG_M | ( | a | ) |
Definition at line 38 of file include/asterisk/logger.h.
#define EVENTLOG "event_log" |
Definition at line 35 of file include/asterisk/logger.h.
#define LOG_DEBUG __LOG_DEBUG, _A_ |
Definition at line 248 of file include/asterisk/logger.h.
#define LOG_DTMF __LOG_DTMF, _A_ |
Definition at line 314 of file include/asterisk/logger.h.
#define LOG_ERROR __LOG_ERROR, _A_ |
Definition at line 292 of file include/asterisk/logger.h.
#define LOG_NOTICE __LOG_NOTICE, _A_ |
Definition at line 270 of file include/asterisk/logger.h.
#define LOG_TRACE __LOG_TRACE, _A_ |
Definition at line 259 of file include/asterisk/logger.h.
#define LOG_VERBOSE __LOG_VERBOSE, _A_ |
Definition at line 303 of file include/asterisk/logger.h.
#define LOG_WARNING __LOG_WARNING, _A_ |
Definition at line 281 of file include/asterisk/logger.h.
#define NUMLOGLEVELS 32 |
Definition at line 321 of file include/asterisk/logger.h.
#define QUEUELOG "queue_log" |
Definition at line 36 of file include/asterisk/logger.h.
#define VERBOSE_HASMAGIC | ( | x | ) | (*(signed char *) (x) < 0) |
Definition at line 202 of file include/asterisk/logger.h.
#define VERBOSE_MAGIC2LEVEL | ( | x | ) | (((char) -*(signed char *) (x)) - 1) |
Definition at line 201 of file include/asterisk/logger.h.
#define VERBOSE_PREFIX_1 " " |
Definition at line 44 of file include/asterisk/logger.h.
#define VERBOSE_PREFIX_10 " > " |
Definition at line 53 of file include/asterisk/logger.h.
#define VERBOSE_PREFIX_2 " == " |
Definition at line 45 of file include/asterisk/logger.h.
#define VERBOSE_PREFIX_3 " -- " |
Definition at line 46 of file include/asterisk/logger.h.
#define VERBOSE_PREFIX_4 " > " |
Definition at line 47 of file include/asterisk/logger.h.
#define VERBOSE_PREFIX_5 " > " |
Definition at line 48 of file include/asterisk/logger.h.
#define VERBOSE_PREFIX_6 " > " |
Definition at line 49 of file include/asterisk/logger.h.
#define VERBOSE_PREFIX_7 " > " |
Definition at line 50 of file include/asterisk/logger.h.
#define VERBOSE_PREFIX_8 " > " |
Definition at line 51 of file include/asterisk/logger.h.
#define VERBOSE_PREFIX_9 " > " |
Definition at line 52 of file include/asterisk/logger.h.
#define VERBOSITY_ATLEAST | ( | level | ) | ((level) <= ast_verb_sys_level) |
Definition at line 466 of file include/asterisk/logger.h.
typedef unsigned int ast_callid |
Definition at line 96 of file include/asterisk/logger.h.
enum ast_logger_results |
Definition at line 57 of file include/asterisk/logger.h.
void __ast_verbose | ( | const char * | file, |
int | line, | ||
const char * | func, | ||
int | level, | ||
const char * | fmt, | ||
... | |||
) |
Send a verbose message (based on verbose level)
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 absence of a comma after the VERBOSE_PREFIX_3. This is important. VERBOSE_PREFIX_1 through VERBOSE_PREFIX_10 are defined.
Definition at line 2550 of file logger.c.
References __ast_verbose_ap(), ast_read_threadstorage_callid(), and make_ari_stubs::file.
void __ast_verbose_ap | ( | const char * | file, |
int | line, | ||
const char * | func, | ||
int | level, | ||
ast_callid | callid, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
Definition at line 2545 of file logger.c.
References __LOG_VERBOSE, ast_log_full(), and make_ari_stubs::file.
Referenced by __ast_verbose(), __ast_verbose_callid(), and ast_log_ap().
void __ast_verbose_callid | ( | const char * | file, |
int | line, | ||
const char * | func, | ||
int | level, | ||
ast_callid | callid, | ||
const char * | fmt, | ||
... | |||
) |
Send a verbose message (based on verbose level) with deliberately specified callid.
just like __ast_verbose, only __ast_verbose_callid allows you to specify which callid is being used for the log without needing to bind it to a thread. NULL is a valid argument for this function and will allow you to specify that a log will never display a call id even when there is a call id bound to the thread.
Definition at line 2562 of file logger.c.
References __ast_verbose_ap(), and make_ari_stubs::file.
void ast_callid_strnprint | ( | char * | buffer, |
size_t | buffer_size, | ||
ast_callid | callid | ||
) |
copy a string representation of the callid into a target string
buffer | destination of callid string (should be able to store 13 characters or more) |
buffer_size | maximum writable length of the string (Less than 13 will result in truncation) |
callid | Callid for which string is being requested |
Definition at line 2288 of file logger.c.
Referenced by ast_channel_callid_set(), func_channel_read(), handle_showchan(), and iax_pvt_callid_new().
int ast_callid_threadassoc_add | ( | ast_callid | callid | ) |
Adds a known callid to thread storage of the calling thread.
0 | - success |
non-zero | - failure |
Definition at line 2320 of file logger.c.
References ast_log(), ast_threadstorage_get(), LOG_ERROR, and unique_callid.
Referenced by __analog_ss_thread(), __ast_pbx_run(), ast_callid_threadstorage_auto(), async_dial(), attended_transfer_monitor_thread(), bridge_channel_control_thread(), bridge_channel_depart_thread(), bridge_channel_ind_thread(), jingle_action_hook(), jingle_outgoing_hook(), mixmonitor_thread(), socket_process_helper(), and softmix_mixing_thread().
int ast_callid_threadassoc_change | ( | ast_callid | callid | ) |
Sets what is stored in the thread storage to the given callid if it does not match what is already there.
0 | - success |
non-zero | - failure |
Definition at line 2307 of file logger.c.
References ast_threadstorage_get(), and unique_callid.
Referenced by autoservice_run(), and bridge_manager_service().
int ast_callid_threadassoc_remove | ( | void | ) |
Removes callid from thread storage of the calling thread.
0 | - success |
non-zero | - failure |
Definition at line 2339 of file logger.c.
References ast_threadstorage_get(), and unique_callid.
Referenced by ast_callid_threadstorage_auto_clean(), attended_transfer_monitor_thread(), jingle_action_hook(), jingle_outgoing_hook(), and socket_process().
int ast_callid_threadstorage_auto | ( | ast_callid * | callid | ) |
Checks thread storage for a callid and stores a reference if it exists. If not, then a new one will be created, bound to the thread, and a reference to it will be stored.
callid | pointer to store the callid |
0 | - callid was found |
1 | - callid was created |
-1 | - the function failed somehow (presumably memory problems) |
Definition at line 2356 of file logger.c.
References ast_callid_threadassoc_add(), ast_create_callid(), ast_read_threadstorage_callid(), and tmp().
Referenced by __analog_handle_event(), analog_handle_init_event(), dahdi_handle_event(), dahdi_request(), do_monitor(), handle_init_event(), mwi_thread(), and my_new_analog_ast_channel().
void ast_callid_threadstorage_auto_clean | ( | ast_callid | callid, |
int | callid_created | ||
) |
Use in conjunction with ast_callid_threadstorage_auto. Cleans up the references and if the callid was created by threadstorage_auto, unbinds the callid from the threadstorage.
callid | The callid set by ast_callid_threadstorage_auto |
callid_created | The integer returned through ast_callid_threadstorage_auto |
Definition at line 2378 of file logger.c.
References ast_callid_threadassoc_remove().
Referenced by __analog_handle_event(), analog_handle_init_event(), dahdi_handle_event(), dahdi_new_callid_clean(), dahdi_request(), do_monitor(), handle_init_event(), and mwi_thread().
void ast_child_verbose | ( | int | level, |
const char * | fmt, | ||
... | |||
) |
Definition at line 921 of file logger.c.
References ast_free, ast_malloc, and NULL.
Referenced by launch_script().
void ast_console_puts | ( | const char * | string | ) |
write the string to the root console, and all attached network console clients
Definition at line 1357 of file asterisk.c.
References ast_network_puts().
void ast_console_puts_mutable | ( | const char * | string, |
int | level | ||
) |
log the string to the console, and all attached console clients
string | The message to write to the console |
level | The log level of the message |
log the string to the console, and all attached console clients
Definition at line 1317 of file asterisk.c.
References ast_console_puts_mutable_full().
Referenced by init_logger_chain(), and make_logchannel().
void ast_console_puts_mutable_full | ( | const char * | message, |
int | level, | ||
int | sublevel | ||
) |
log the string to the console, and all attached console clients
message | The message to write to the console |
sublevel | If the log level supports it, the sub-level of the message |
level | The log level of the message |
Definition at line 1324 of file asterisk.c.
References ast_network_puts_mutable(), ast_opt_console, AST_PTHREADT_NULL, console_print(), and consolethread.
Referenced by ast_console_puts_mutable(), and logger_print_normal().
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 receiving the level change level specifies the index of the logging level being toggled state indicates whether logging will be on or off (0 for off, 1 for on)
enables or disables logging of a specified level to the console fd specifies the index of the console receiving the level change level specifies the index of the logging level being toggled state indicates whether logging will be on or off (0 for off, 1 for on)
Definition at line 1252 of file asterisk.c.
References AST_MAX_CONNECTS, consoles, console::levels, and NUMLOGLEVELS.
Referenced by handle_logger_set_level().
void ast_console_toggle_mute | ( | int | fd, |
int | silent | ||
) |
mute or unmute a console from logging
Definition at line 1275 of file asterisk.c.
References ast_cli(), AST_MAX_CONNECTS, consoles, and console::mute.
Referenced by handle_logger_mute().
ast_callid ast_create_callid | ( | void | ) |
factory function to create a new uniquely identifying callid.
Definition at line 2293 of file logger.c.
References ast_atomic_fetchadd_int(), and next_unique_callid.
Referenced by __ast_pbx_run(), ast_callid_threadstorage_auto(), iax_pvt_callid_new(), and jingle_alloc().
unsigned int ast_debug_get_by_module | ( | const char * | module | ) |
Get the debug level for a module.
module | the name of module |
Definition at line 136 of file main/cli.c.
References AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, debug_modules, and module_level::level.
int ast_is_logger_initialized | ( | void | ) |
Test if logger is initialized.
true | if the logger is initialized |
Definition at line 2175 of file logger.c.
References logger_initialized.
Referenced by check_init().
static 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 invoke it would be something like this: ast_log(AST_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.
level | Type of log event |
file | Will be provided by the AST_LOG_* macro |
line | Will be provided by the AST_LOG_* macro |
function | Will be provided by the AST_LOG_* macro |
fmt | This is what is important. The format is the same as your favorite breed of printf. You know how that works, right? :-) |
Definition at line 130 of file ael_main.c.
References ast_log_ap(), make_ari_stubs::file, logmsg::function, logmsg::level, and logmsg::line.
Referenced by ast_callid_threadassoc_add(), ast_log_backtrace(), init_logger(), log_group_write(), logger_queue_init(), logger_queue_restart(), logger_register_level(), main(), and rotate_file().
void ast_log_ap | ( | int | level, |
const char * | file, | ||
int | line, | ||
const char * | function, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
Definition at line 2462 of file logger.c.
References __ast_verbose_ap(), __LOG_VERBOSE, ast_log_full(), ast_read_threadstorage_callid(), logmsg::callid, make_ari_stubs::file, logmsg::function, logmsg::level, and logmsg::line.
Referenced by ast_log(), and module_load_error().
void ast_log_backtrace | ( | void | ) |
Log a backtrace of the current thread's execution stack to the Asterisk log.
Definition at line 2510 of file logger.c.
References __LOG_ERROR, ast_bt::addresses, ast_bt_create, ast_bt_destroy, ast_bt_free_symbols, ast_bt_get_symbols, ast_free, ast_log(), ast_log_safe(), ast_str_append(), ast_str_buffer(), ast_str_create, AST_VECTOR_GET, AST_VECTOR_SIZE, buf, LOG_ERROR, LOG_WARNING, NULL, and ast_bt::num_frames.
Referenced by __ast_assert_failed(), ast_json_vpack(), ast_sched_del_nonrunning(), and AST_TEST_DEFINE().
void ast_log_callid | ( | int | level, |
const char * | file, | ||
int | line, | ||
const char * | function, | ||
ast_callid | callid, | ||
const char * | fmt, | ||
... | |||
) |
Used for sending a log message with a known call_id This is a modified logger function which is functionally identical to the above logger function, it just include a call_id argument as well. If NULL is specified here, no attempt will be made to join the log message with a call_id.
level | Type of log event |
file | Will be provided by the AST_LOG_* macro |
line | Will be provided by the AST_LOG_* macro |
function | Will be provided by the AST_LOG_* macro |
callid | This is the ast_callid that is associated with the log message. May be NULL. |
fmt | This is what is important. The format is the same as your favorite breed of printf. You know how that works, right? :-) |
Definition at line 2501 of file logger.c.
References ast_log_full(), logmsg::callid, make_ari_stubs::file, logmsg::function, logmsg::level, and logmsg::line.
Referenced by ast_channel_destructor().
void ast_log_safe | ( | int | level, |
const char * | file, | ||
int | line, | ||
const char * | function, | ||
const char * | fmt, | ||
... | |||
) |
Used for sending a log message with protection against recursion.
Definition at line 2475 of file logger.c.
References ast_log_full(), ast_read_threadstorage_callid(), ast_threadstorage_get_ptr(), ast_threadstorage_set_ptr(), logmsg::callid, make_ari_stubs::file, logmsg::function, logmsg::level, logmsg::line, and NULL.
Referenced by __ast_str_helper(), and ast_log_backtrace().
int ast_logger_create_channel | ( | const char * | log_channel, |
const char * | components | ||
) |
Create a log channel.
log_channel | Log channel to create |
components | Logging config levels to add to the log channel |
Definition at line 1521 of file logger.c.
References AST_LOGGER_ALLOC_ERROR, AST_LOGGER_DECLINE, AST_LOGGER_FAILURE, AST_LOGGER_SUCCESS, AST_RWLIST_INSERT_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero(), logchannel::components, find_logchannel(), global_logmask, logchannel::list, logchannel::logmask, and make_logchannel().
Referenced by ast_ari_asterisk_add_log(), handle_cli_queue_test(), and handle_logger_add_channel().
int ast_logger_get_channels | ( | int(*)(const char *channel, const char *type, const char *status, const char *configuration, void *data) | logentry, |
void * | data | ||
) |
Retrieve the existing log channels.
logentry | A callback to an updater function |
data | Data passed into the callback for manipulation |
For each of the logging channels, logentry will be executed with the channel file name, log type, status of the log, and configuration levels.
0 | on success |
1 | on failure |
-2 | on allocation error |
Definition at line 1409 of file logger.c.
References ARRAY_LEN, ast_free, AST_LOGGER_ALLOC_ERROR, AST_LOGGER_FAILURE, AST_LOGGER_SUCCESS, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_reset(), logchannel::disabled, logchannel::filename, levels, logchannel::logmask, LOGTYPE_CONSOLE, LOGTYPE_SYSLOG, NULL, and logchannel::type.
Referenced by ast_ari_asterisk_list_log_channels().
const char * ast_logger_get_dateformat | ( | void | ) |
Get the logger configured date format.
Definition at line 2927 of file logger.c.
References dateformat.
Referenced by set_header().
int ast_logger_get_dynamic_level | ( | const char * | name | ) |
Retrieve dynamic logging level id.
name | The name of the level |
-1 | if level name not found |
Definition at line 2880 of file logger.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, logger_get_dynamic_level(), and name.
Referenced by log_exec().
int ast_logger_get_queue_limit | ( | void | ) |
Get the maximum number of messages allowed in the processing queue.
Definition at line 2937 of file logger.c.
References logger_queue_limit.
Referenced by handle_cli_queue_test().
int ast_logger_register_level | ( | const char * | name | ) |
Register a new logger level.
name | The name of the level to be registered |
-1 | if an error occurs |
non-zero | level to be used with ast_log for sending messages to this level |
Definition at line 2851 of file logger.c.
References AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, available(), logger_register_level(), and name.
Referenced by handle_cli_dynamic_level_test(), handle_cli_performance_test(), handle_cli_queue_test(), and load_module().
int ast_logger_remove_channel | ( | const char * | log_channel | ) |
Delete the specified log channel.
log_channel | The log channel to delete |
Definition at line 1587 of file logger.c.
References ast_free, AST_LOGGER_FAILURE, AST_LOGGER_SUCCESS, AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, logchannel::dynamic, logchannel::fileptr, find_logchannel(), logchannel::list, and NULL.
Referenced by ast_ari_asterisk_delete_log(), handle_cli_queue_test(), and handle_logger_remove_channel().
int ast_logger_rotate | ( | void | ) |
Reload logger while rotating log files.
Definition at line 1327 of file logger.c.
References NULL, and reload_logger().
Referenced by action_loggerrotate().
int ast_logger_rotate_channel | ( | const char * | log_channel | ) |
Rotate the specified log channel.
log_channel | The log channel to rotate |
Definition at line 1332 of file logger.c.
References ast_config_AST_LOG_DIR, AST_LOGGER_FAILURE, AST_LOGGER_SUCCESS, ast_mkdir(), AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, logchannel::disabled, EVENT_FLAG_SYSTEM, logchannel::filename, logchannel::fileptr, init_logger_chain(), logchannel::list, make_filename(), manager_event, NULL, PATH_MAX, and rotate_file().
Referenced by ast_ari_asterisk_rotate_log().
void ast_logger_set_queue_limit | ( | int | queue_limit | ) |
Set the maximum number of messages allowed in the processing queue.
queue_limit |
Definition at line 2932 of file logger.c.
References logger_queue_limit.
Referenced by handle_cli_queue_test().
void ast_logger_unregister_level | ( | const char * | name | ) |
Unregister a previously registered logger level.
name | The name of the level to be unregistered |
Definition at line 2909 of file logger.c.
References ast_debug, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, logger_unregister_level(), name, and update_logchannels().
Referenced by handle_cli_dynamic_level_test(), handle_cli_performance_test(), handle_cli_queue_test(), load_module(), and unload_module().
void ast_queue_log | ( | const char * | queuename, |
const char * | callid, | ||
const char * | agent, | ||
const char * | event, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 965 of file logger.c.
References args, AST_APP_ARG, ast_check_realtime(), AST_DECLARE_APP_ARGS, ast_localtime(), AST_NONSTANDARD_APP_ARGS, ast_realtime_require_field(), AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_store_realtime(), ast_strftime(), ast_tvnow(), logfiles, logger_initialized, logger_queue_start(), NULL, qlog, queuelog_init, RQ_CHAR, S_OR, and SENTINEL.
Referenced by aqm_exec(), find_queue_by_name_rt(), handle_blind_transfer(), handle_hangup(), handle_queue_add_member(), handle_queue_remove_member(), log_attended_transfer(), manager_add_queue_member(), manager_queue_log_custom(), manager_remove_queue_member(), ql_exec(), queue_agent_cb(), queue_exec(), qupd_exec(), rna(), rqm_exec(), rt_handle_member_record(), set_member_paused(), set_member_penalty_help_members(), set_queue_member_pause(), set_queue_member_ringinuse(), try_calling(), update_realtime_members(), wait_for_answer(), and wait_our_turn().
ast_callid ast_read_threadstorage_callid | ( | void | ) |
extracts the callerid from the thread
Non-zero | Call id related to the thread |
0 | if no call_id is present in the thread |
Definition at line 2298 of file logger.c.
References ast_threadstorage_get(), and unique_callid.
Referenced by __ast_pbx_run(), __ast_verbose(), ast_callid_threadstorage_auto(), ast_dial_run(), ast_log_ap(), ast_log_safe(), bridge_channel_internal_join(), bridge_impart_internal(), callid_set_chanloggroup(), common_recall_channel_setup(), iax2_request(), jingle_alloc(), launch_monitor_thread(), local_request_with_stream_topology(), media_request_helper(), and socket_process().
int ast_register_verbose | ( | void(*)(const char *string) | verboser | ) |
int ast_unregister_verbose | ( | void(*)(const char *string) | verboser | ) |
int ast_verb_console_get | ( | void | ) |
Get this thread's console verbosity level.
Definition at line 2673 of file logger.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_threadstorage_get(), my_verb_console, and option_verbose.
Referenced by handle_show_settings(), and handle_verbose().
void ast_verb_console_register | ( | int * | level | ) |
Register this thread's console verbosity level pointer.
level | Where the verbose level value is. |
Definition at line 2646 of file logger.c.
References AST_RWLIST_INSERT_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_threadstorage_get(), ast_verb_update(), verb_console::level, and my_verb_console.
Referenced by netconsole().
void ast_verb_console_set | ( | int | verb_level | ) |
Set this thread's console verbosity level.
verb_level | New level to set. |
Definition at line 2691 of file logger.c.
References AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_threadstorage_get(), ast_verb_update(), my_verb_console, and option_verbose.
Referenced by handle_verbose().
void ast_verb_console_unregister | ( | void | ) |
Unregister this thread's console verbosity level.
Definition at line 2662 of file logger.c.
References ast_threadstorage_get(), my_verb_console, and verb_console_unregister().
Referenced by netconsole().
void ast_verb_update | ( | void | ) |
Re-evaluate the system max verbosity level (ast_verb_sys_level).
Definition at line 2584 of file logger.c.
References AST_LIST_TRAVERSE, ast_mutex_lock, ast_mutex_unlock, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_verb_sys_level, verb_console::level, option_verbose, verb_update_lock, and logchannel::verbosity.
Referenced by ast_verb_console_register(), ast_verb_console_set(), init_logger(), reload_logger(), and verb_console_unregister().