Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Asterisk Logger. More...
#include "asterisk.h"
#include <syslog.h>
#include <signal.h>
#include <time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "asterisk/_private.h"
#include "asterisk/module.h"
#include "asterisk/paths.h"
#include "asterisk/logger.h"
#include "asterisk/logger_category.h"
#include "asterisk/lock.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
#include "asterisk/term.h"
#include "asterisk/cli.h"
#include "asterisk/utils.h"
#include "asterisk/manager.h"
#include "asterisk/astobj2.h"
#include "asterisk/threadstorage.h"
#include "asterisk/strings.h"
#include "asterisk/pbx.h"
#include "asterisk/app.h"
#include "asterisk/buildinfo.h"
#include "asterisk/ast_version.h"
#include "asterisk/backtrace.h"
#include "asterisk/json.h"
Go to the source code of this file.
Data Structures | |
struct | chan_group_lock |
map call ID to group More... | |
struct | chan_group_lock_list |
struct | logchannel |
struct | logchannels |
struct | logformatter |
struct | logmsg |
struct | logmsgs |
struct | verb_console |
struct | verb_consoles |
Macros | |
#define | FORMATL "%-35.35s %-8.8s %-10.10s %-9.9s " |
#define | FORMATL2 "%5s %s\n" |
#define | LOG_BUF_INIT_SIZE 256 |
#define | LOGMSG_SIZE MAX(BUFSIZ, 8192) |
#define | VERBOSE_BUF_INIT_SIZE 256 |
Enumerations | |
enum | logmsgtypes { LOGMSG_NORMAL = 0 , LOGMSG_VERBOSE } |
enum | logtypes { LOGTYPE_SYSLOG , LOGTYPE_FILE , LOGTYPE_CONSOLE } |
enum | rotatestrategy { NONE = 0 , SEQUENTIAL = 1 << 0 , ROTATE = 1 << 1 , TIMESTAMP = 1 << 2 } |
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... | |
static void | __init_callid_group_name (void) |
static void | __init_log_buf (void) |
static void | __init_my_verb_console (void) |
static void | __init_unique_callid (void) |
static void | __init_verbose_buf (void) |
static void | __init_verbose_build_buf (void) |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static void | _handle_SIGXFSZ (int sig) |
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,...) |
ast_callid | ast_create_callid (void) |
factory function to create a new uniquely identifying callid. 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... | |
static void | ast_log_full (int level, int sublevel, const char *file, int line, const char *function, ast_callid callid, const char *fmt, va_list ap) |
send log messages to syslog and/or the console 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 () |
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... | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
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... | |
AST_THREADSTORAGE_RAW (in_safe_log) | |
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... | |
static int | callid_group_remove_filters (void) |
static int | callid_group_set_filter (const char *group, int enabled) |
static int | callid_logging_enabled (void) |
static int | callid_set_chanloggroup (const char *group) |
void | close_logger (void) |
static int | custom_level_still_exists (char **levels, char *level, size_t len) |
Checks if level exists in array of level names. More... | |
static struct logchannel * | find_logchannel (const char *channel) |
Find a particular logger channel by name. More... | |
static int | format_log_default (struct logchannel *chan, struct logmsg *msg, char *buf, size_t size) |
static int | format_log_json (struct logchannel *channel, struct logmsg *msg, char *buf, size_t size) |
static struct logmsg * | format_log_message (int level, int sublevel, const char *file, int line, const char *function, ast_callid callid, const char *fmt,...) |
static struct logmsg * | format_log_message_ap (int level, int sublevel, const char *file, int line, const char *function, ast_callid callid, const char *fmt, va_list ap) |
static int | format_log_plain (struct logchannel *chan, struct logmsg *msg, char *buf, size_t size) |
static const char * | get_callid_group (void) |
static char * | handle_logger_add_channel (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_logger_chanloggroup_filter (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_logger_filter_reset (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_logger_filter_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_logger_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_logger_remove_channel (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_logger_rotate (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_logger_set_level (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_logger_show_channels (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command to show logging system configuration. More... | |
static char * | handle_logger_show_levels (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command to show logging levels. More... | |
int | init_logger (void) |
static int | init_logger_chain (const char *altconf) |
Read config, setup channels. More... | |
static int | load_module (void) |
static int | log_group_write (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
static int | logger_add_verbose_magic (struct logmsg *logmsg, char *buf, size_t size) |
static int | logger_get_dynamic_level (const char *name) |
static void | logger_print_normal (struct logmsg *logmsg) |
Print a normal log message to the channels. More... | |
static void | logger_queue_init (void) |
static int | logger_queue_restart (int queue_rotate) |
static int | logger_queue_rt_start (void) |
void | logger_queue_start (void) |
Start the ast_queue_log() logger. More... | |
static int | logger_register_level (const char *name) |
static void * | logger_thread (void *data) |
Actual logging thread. More... | |
static int | logger_unregister_level (const char *name) |
static void | logmsg_free (struct logmsg *msg) |
static void | make_components (struct logchannel *chan) |
static void | make_filename (const char *channel, char *filename, size_t size) |
create the filename that will be used for a logger channel. More... | |
static struct logchannel * | make_logchannel (const char *channel, const char *components, int lineno, int dynamic) |
static int | reload_logger (int rotate, const char *altconf) |
static int | reload_module (void) |
static int | rotate_file (const char *filename) |
static int | unload_module (void) |
static void | update_logchannels (void) |
static void | verb_console_free (void *v_console) |
static void | verb_console_unregister (struct verb_console *console) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "Logger" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload_module, .load_pri = 0, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static int | callid_filtering = 0 |
static struct ast_threadstorage | callid_group_name = { .once = PTHREAD_ONCE_INIT , .key_init = __init_callid_group_name , .custom_init = NULL , } |
struct chan_group_lock_list | chan_group_lock_list = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static struct ast_cli_entry | cli_logger [] |
static int | close_logger_thread = 0 |
static const int | colors [NUMLOGLEVELS] |
Colors used in the console for logging. More... | |
static char * | custom_dynamic_levels [NUMLOGLEVELS] |
Custom dynamic logging levels added by the user. More... | |
static char | dateformat [256] = "%b %e %T" |
static int | display_callids |
static char | exec_after_rotate [256] = "" |
static int | filesize_reload_needed |
static unsigned int | global_logmask = 0xFFFF |
static struct sigaction | handle_SIGXFSZ |
static unsigned int | high_water_alert |
static char | hostname [MAXHOSTNAMELEN] |
static char * | levels [NUMLOGLEVELS] |
Logging channels used in the Asterisk logging system. More... | |
static struct ast_threadstorage | log_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_log_buf , .custom_init = NULL , } |
static struct ast_custom_function | log_group_function |
static struct logchannels | logchannels = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static ast_cond_t | logcond |
struct { | |
unsigned int queue_adaptive_realtime:1 | |
unsigned int queue_log:1 | |
unsigned int queue_log_realtime_use_gmt:1 | |
unsigned int queue_log_to_file:1 | |
} | logfiles = { 1 } |
static struct logformatter | logformatter_default |
static struct logformatter | logformatter_json |
static struct logformatter | logformatter_plain |
static int | logger_initialized |
static int | logger_messages_discarded |
static int | logger_queue_limit = 1000 |
static int | logger_queue_size |
static struct logmsgs | logmsgs = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , } |
static pthread_t | logthread = AST_PTHREADT_NULL |
static struct ast_threadstorage | my_verb_console = { .once = PTHREAD_ONCE_INIT , .key_init = __init_my_verb_console , .custom_init = NULL , } |
static volatile int | next_unique_callid = 1 |
static FILE * | qlog |
static char | queue_log_name [256] = QUEUELOG |
static int | queuelog_init |
static enum rotatestrategy | rotatestrategy = SEQUENTIAL |
static struct ast_threadstorage | unique_callid = { .once = PTHREAD_ONCE_INIT , .key_init = __init_unique_callid , .custom_init = NULL , } |
static struct verb_consoles | verb_consoles = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static ast_mutex_t | verb_update_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static struct ast_threadstorage | verbose_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_verbose_buf , .custom_init = NULL , } |
static struct ast_threadstorage | verbose_build_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_verbose_build_buf , .custom_init = NULL , } |
#define FORMATL "%-35.35s %-8.8s %-10.10s %-9.9s " |
#define FORMATL2 "%5s %s\n" |
enum logmsgtypes |
Enumerator | |
---|---|
LOGMSG_NORMAL | |
LOGMSG_VERBOSE |
enum logtypes |
Enumerator | |
---|---|
LOGTYPE_SYSLOG | |
LOGTYPE_FILE | |
LOGTYPE_CONSOLE |
enum rotatestrategy |
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.
|
static |
|
static |
|
static |
Definition at line 1904 of file logger.c.
References filesize_reload_needed.
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().
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().
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().
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 2453 of file logger.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(), 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().
|
static |
send log messages to syslog and/or the console
Definition at line 2389 of file logger.c.
References __LOG_DEBUG, __LOG_DTMF, __LOG_TRACE, __LOG_VERBOSE, __LOG_WARNING, ast_cond_signal, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_opt_exec, ast_opt_remote, AST_PTHREADT_NULL, logmsg::callid, callid_filtering, callid_logging_enabled(), close_logger_thread, make_ari_stubs::file, format_log_message(), format_log_message_ap(), logmsg::function, logmsg::hidecli, high_water_alert, logmsg::level, logmsg::line, logmsg::list, logcond, logger_messages_discarded, logger_print_normal(), logger_queue_limit, logger_queue_size, logmsg_free(), logthread, NULL, and logmsg::sublevel.
Referenced by __ast_verbose_ap(), ast_log_ap(), ast_log_callid(), and ast_log_safe().
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().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
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(), logger_queue_start(), manager_add_queue_member(), manager_queue_log_custom(), manager_remove_queue_member(), ql_exec(), queue_agent_cb(), queue_exec(), qupd_exec(), reload_logger(), 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().
AST_THREADSTORAGE_RAW | ( | in_safe_log | ) |
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().
|
static |
Definition at line 1714 of file logger.c.
References ast_free, AST_RWLIST_REMOVE_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and callid_filtering.
Referenced by close_logger(), and handle_logger_filter_reset().
|
static |
Definition at line 1729 of file logger.c.
References ast_calloc, ast_free, AST_LIST_EMPTY, AST_RWLIST_INSERT_HEAD, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, callid_filtering, and enabled.
Referenced by handle_logger_chanloggroup_filter().
|
static |
Definition at line 1767 of file logger.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, callid_filtering, and get_callid_group().
Referenced by ast_log_full().
|
static |
Definition at line 1682 of file logger.c.
References ast_assert, ast_free, ast_read_threadstorage_callid(), ast_strdup, ast_threadstorage_get(), and callid_group_name.
Referenced by log_group_write().
void close_logger | ( | void | ) |
Provided by logger.c
Definition at line 2245 of file logger.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), ast_cond_signal, ast_custom_function_unregister(), ast_free, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_logger_category_unload(), AST_PTHREADT_NULL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, callid_group_remove_filters(), cli_logger, close_logger_thread, logchannel::fileptr, logchannel::list, log_group_function, logcond, logger_initialized, logthread, NULL, and qlog.
Referenced by really_quit().
|
static |
Checks if level exists in array of level names.
levels | Array of level names |
level | Name to search for |
len | Size of levels |
1 | Found |
0 | Not Found |
Definition at line 739 of file logger.c.
Referenced by init_logger_chain().
|
static |
Find a particular logger channel by name.
channel | The name of the logger channel to find |
non-NULL | The corresponding logger channel |
NULL | Unable to find a logger channel with that particular name |
Definition at line 630 of file logger.c.
References AST_RWLIST_TRAVERSE, logchannel::filename, logchannel::list, make_filename(), NULL, and PATH_MAX.
Referenced by ast_logger_create_channel(), and ast_logger_remove_channel().
|
static |
Definition at line 394 of file logger.c.
References __LOG_VERBOSE, ast_strlen_zero(), buf, logmsg::callid, COLOR_BRWHITE, COLORIZE, COLORIZE_FMT, colors, logmsg::date, logmsg::file, logmsg::function, logmsg::level, logmsg::level_name, levels, logmsg::line, logger_add_verbose_magic(), LOGTYPE_CONSOLE, LOGTYPE_FILE, LOGTYPE_SYSLOG, logmsg::lwp, logmsg::message, term_strip(), and logchannel::type.
|
static |
Definition at line 276 of file logger.c.
References ast_config_AST_SYSTEM_NAME, ast_copy_string(), ast_json_dump_string, ast_json_free(), ast_json_pack(), ast_json_unref(), buf, logmsg::callid, logmsg::date, logmsg::file, logmsg::function, logmsg::level_name, logmsg::line, logmsg::lwp, logmsg::message, S_OR, str, and term_strip().
|
static |
Definition at line 2082 of file logger.c.
References logmsg::callid, make_ari_stubs::file, format_log_message_ap(), logmsg::function, logmsg::level, logmsg::line, and logmsg::sublevel.
Referenced by ast_log_full(), and logger_thread().
|
static |
Definition at line 2018 of file logger.c.
References __LOG_VERBOSE, ast_calloc_with_stringfields, AST_DYNSTR_BUILD_FAILED, ast_ends_with(), ast_get_tid(), ast_localtime(), ast_str_append(), ast_str_buffer(), ast_str_set_va(), ast_str_thread_get(), ast_strftime(), ast_string_field_set, ast_tvnow(), buf, logmsg::callid, dateformat, display_callids, make_ari_stubs::file, logmsg::level, levels, logmsg::line, log_buf, LOG_BUF_INIT_SIZE, LOGMSG_NORMAL, LOGMSG_SIZE, LOGMSG_VERBOSE, logmsg::lwp, NULL, logmsg::sublevel, and logmsg::type.
Referenced by ast_log_full(), and format_log_message().
|
static |
Definition at line 458 of file logger.c.
References ast_strlen_zero(), buf, logmsg::callid, logmsg::date, logmsg::file, logmsg::function, logmsg::level, logmsg::level_name, levels, logmsg::line, LOGTYPE_CONSOLE, LOGTYPE_FILE, LOGTYPE_SYSLOG, logmsg::lwp, logmsg::message, term_strip(), and logchannel::type.
|
static |
Definition at line 1675 of file logger.c.
References ast_threadstorage_get(), callid_group_name, and NULL.
Referenced by callid_logging_enabled().
|
static |
Definition at line 1551 of file logger.c.
References a, ast_cli(), AST_LOGGER_ALLOC_ERROR, ast_logger_create_channel(), AST_LOGGER_DECLINE, AST_LOGGER_FAILURE, AST_LOGGER_SUCCESS, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 1806 of file logger.c.
References a, ast_cli(), ast_true(), callid_group_set_filter(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, enabled, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 1868 of file logger.c.
References a, ast_cli(), callid_group_remove_filters(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ESS, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 1838 of file logger.c.
References a, ast_cli(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ESS, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 1289 of file logger.c.
References a, ast_cli(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, NULL, reload_logger(), and ast_cli_entry::usage.
|
static |
Definition at line 1612 of file logger.c.
References a, ast_cli(), AST_LOGGER_FAILURE, ast_logger_remove_channel(), AST_LOGGER_SUCCESS, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strdup, ast_strlen_zero(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, logchannel::dynamic, logchannel::filename, logchannel::list, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 1308 of file logger.c.
References a, ast_cli(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, NULL, reload_logger(), and ast_cli_entry::usage.
|
static |
Definition at line 1367 of file logger.c.
References a, ARRAY_LEN, ast_cli(), ast_console_toggle_loglevel(), AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_true(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, levels, NULL, state, and ast_cli_entry::usage.
|
static |
CLI command to show logging system configuration.
Definition at line 1452 of file logger.c.
References a, ARRAY_LEN, ast_cli(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, logchannel::disabled, logchannel::filename, FORMATL, logchannel::formatter, levels, logchannel::list, logger_queue_limit, logchannel::logmask, LOGTYPE_CONSOLE, LOGTYPE_SYSLOG, logformatter::name, NULL, logchannel::type, and ast_cli_entry::usage.
|
static |
CLI command to show logging levels.
Definition at line 1493 of file logger.c.
References a, ARRAY_LEN, ast_cli(), AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, FORMATL2, levels, NULL, and ast_cli_entry::usage.
int init_logger | ( | void | ) |
Provided by logger.c
Definition at line 2202 of file logger.c.
References ARRAY_LEN, ast_cli_register_multiple, ast_cond_destroy, ast_cond_init, ast_config_AST_LOG_DIR, ast_custom_function_register, ast_log(), ast_logger_category_load(), ast_mkdir(), ast_mutex_destroy, ast_mutex_init, ast_pthread_create, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb_update(), cli_logger, handle_SIGXFSZ, init_logger_chain(), logmsgs::lock, LOG_ERROR, log_group_function, logcond, logger_initialized, logger_thread(), logthread, and NULL.
Referenced by asterisk_daemon().
|
static |
Read config, setup channels.
altconf | Alternate configuration file to read. |
0 | Success |
-1 | No config found or Failed |
Definition at line 759 of file logger.c.
References __LOG_ERROR, ARRAY_LEN, ast_config_destroy(), ast_config_load2(), ast_console_puts_mutable(), ast_copy_string(), ast_free, AST_RWLIST_INSERT_HEAD, AST_RWLIST_REMOVE_HEAD, ast_strdupa, ast_true(), ast_variable_browse(), ast_variable_retrieve(), CONFIG_STATUS_FILEINVALID, custom_dynamic_levels, custom_level_still_exists(), dateformat, display_callids, errno, exec_after_rotate, global_logmask, hostname, levels, logfiles, logger_get_dynamic_level(), logger_queue_limit, logger_register_level(), logger_unregister_level(), logchannel::logmask, make_logchannel(), NONE, NULL, qlog, queue_log_name, QUEUELOG, ROTATE, S_OR, SEQUENTIAL, strsep(), TIMESTAMP, and var.
Referenced by ast_logger_rotate_channel(), init_logger(), and reload_logger().
|
static |
|
static |
Definition at line 1791 of file logger.c.
References ast_channel_name(), ast_log(), callid_set_chanloggroup(), LOG_ERROR, and value.
|
static |
Definition at line 336 of file logger.c.
References ast_str_append(), ast_str_append_substr(), ast_str_buffer(), ast_str_reset(), ast_str_thread_get(), buf, logmsg::message, logmsg::sublevel, verbose_buf, VERBOSE_BUF_INIT_SIZE, VERBOSE_PREFIX_1, VERBOSE_PREFIX_10, VERBOSE_PREFIX_2, VERBOSE_PREFIX_3, VERBOSE_PREFIX_4, VERBOSE_PREFIX_5, VERBOSE_PREFIX_6, VERBOSE_PREFIX_7, VERBOSE_PREFIX_8, and VERBOSE_PREFIX_9.
Referenced by format_log_default().
|
static |
Definition at line 2862 of file logger.c.
References ARRAY_LEN, levels, and name.
Referenced by ast_logger_get_dynamic_level(), init_logger_chain(), and logger_unregister_level().
|
static |
Print a normal log message to the channels.
Definition at line 1916 of file logger.c.
References __LOG_VERBOSE, ast_console_puts_mutable_full(), AST_RWLIST_EMPTY, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strlen_zero(), ast_syslog_priority_from_loglevel(), ast_verb, buf, logchannel::disabled, errno, EVENT_FLAG_SYSTEM, logchannel::facility, logchannel::filename, logchannel::fileptr, filesize_reload_needed, logformatter::format_log, logchannel::formatter, logmsg::hidecli, logmsg::level, logchannel::list, logchannel::logmask, LOGMSG_SIZE, LOGTYPE_CONSOLE, LOGTYPE_FILE, LOGTYPE_SYSLOG, manager_event, logmsg::message, NULL, option_verbose, reload_logger(), logmsg::sublevel, logchannel::type, and logchannel::verbosity.
Referenced by ast_log_full(), and logger_thread().
|
static |
Definition at line 2151 of file logger.c.
References ast_config_AST_LOG_DIR, ast_log(), ast_unload_realtime(), errno, LOG_ERROR, logfiles, logger_queue_rt_start(), PATH_MAX, qlog, and queue_log_name.
Referenced by logger_queue_start().
|
static |
Definition at line 1184 of file logger.c.
References ast_config_AST_LOG_DIR, ast_log(), errno, LOG_ERROR, logger_queue_rt_start(), NULL, PATH_MAX, qlog, queue_log_name, and rotate_file().
Referenced by reload_logger().
|
static |
Definition at line 1149 of file logger.c.
References ast_check_realtime(), ast_realtime_require_field(), logfiles, RQ_CHAR, RQ_DATETIME, and SENTINEL.
Referenced by logger_queue_init(), and logger_queue_restart().
void logger_queue_start | ( | void | ) |
Start the ast_queue_log() logger.
Definition at line 2186 of file logger.c.
References ast_assert, ast_queue_log(), AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, logger_initialized, logger_queue_init(), and queuelog_init.
Referenced by ast_queue_log(), and asterisk_daemon().
|
static |
Definition at line 2814 of file logger.c.
References ARRAY_LEN, ast_debug, ast_log(), ast_strdup, available(), levels, LOG_WARNING, name, and update_logchannels().
Referenced by ast_logger_register_level(), and init_logger_chain().
|
static |
Actual logging thread.
Definition at line 2097 of file logger.c.
References __LOG_WARNING, ast_cond_wait, AST_LIST_EMPTY, AST_LIST_FIRST, AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_NEXT, AST_LIST_UNLOCK, close_logger_thread, format_log_message(), high_water_alert, logmsg::list, logmsgs::lock, logcond, logger_messages_discarded, logger_print_normal(), logger_queue_size, logmsg_free(), logmsg::next, and NULL.
Referenced by init_logger().
|
static |
Definition at line 2893 of file logger.c.
References ast_free, global_logmask, levels, logger_get_dynamic_level(), name, and NULL.
Referenced by ast_logger_unregister_level(), and init_logger_chain().
|
static |
Definition at line 190 of file logger.c.
References ast_free, and ast_string_field_free_memory.
Referenced by ast_log_full(), and logger_thread().
|
static |
Definition at line 508 of file logger.c.
References __LOG_VERBOSE, ARRAY_LEN, ast_strdupa, ast_strip(), ast_strlen_zero(), logchannel::components, end, logchannel::filename, logchannel::formatter, levels, logformatter_default, logformatter_json, logformatter_plain, logchannel::logmask, LOGTYPE_CONSOLE, logformatter::name, strsep(), logchannel::type, and logchannel::verbosity.
Referenced by make_logchannel(), and update_logchannels().
|
static |
create the filename that will be used for a logger channel.
channel | The name of the logger channel | |
[out] | filename | The filename for the logger channel |
size | The size of the filename buffer |
Definition at line 589 of file logger.c.
References ast_config_AST_LOG_DIR, ast_copy_string(), ast_strlen_zero(), and hostname.
Referenced by ast_logger_rotate_channel(), find_logchannel(), and make_logchannel().
|
static |
Definition at line 646 of file logger.c.
References __LOG_ERROR, ast_build_date, ast_build_hostname, ast_build_machine, ast_build_os, ast_build_user, ast_calloc, ast_console_puts_mutable(), ast_free, ast_get_version(), ast_localtime(), ast_strftime(), ast_strlen_zero(), ast_syslog_facility(), ast_tvnow(), logchannel::components, dateformat, logchannel::dynamic, errno, logchannel::facility, logchannel::filename, logchannel::fileptr, logchannel::lineno, LOGTYPE_CONSOLE, LOGTYPE_FILE, LOGTYPE_SYSLOG, make_components(), make_filename(), NULL, and logchannel::type.
Referenced by ast_logger_create_channel(), and init_logger_chain().
|
static |
Definition at line 1212 of file logger.c.
References ast_config_AST_LOG_DIR, ast_mkdir(), ast_queue_log(), AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_unload_realtime(), ast_verb, ast_verb_update(), logchannel::disabled, EVENT_FLAG_SYSTEM, logchannel::filename, logchannel::fileptr, filesize_reload_needed, init_logger_chain(), logchannel::list, logfiles, logger_queue_restart(), manager_event, NONE, NULL, qlog, and rotate_file().
Referenced by ast_logger_rotate(), handle_logger_reload(), handle_logger_rotate(), logger_print_normal(), and reload_module().
|
static |
Definition at line 2942 of file logger.c.
References NULL, and reload_logger().
|
static |
Definition at line 1045 of file logger.c.
References ARRAY_LEN, ast_channel_unref, ast_dummy_channel_alloc, ast_log(), ast_safe_system(), ast_strlen_zero(), buf, c, exec_after_rotate, LOG_WARNING, NONE, NULL, PATH_MAX, pbx_builtin_setvar_helper(), pbx_substitute_variables_helper(), ROTATE, SEQUENTIAL, and TIMESTAMP.
Referenced by ast_logger_rotate_channel(), logger_queue_restart(), and reload_logger().
|
static |
|
static |
Definition at line 2710 of file logger.c.
References AST_RWLIST_TRAVERSE, global_logmask, logchannel::list, logchannel::logmask, and make_components().
Referenced by ast_logger_unregister_level(), and logger_register_level().
|
static |
Definition at line 2635 of file logger.c.
References ast_free, and verb_console_unregister().
|
static |
Definition at line 2625 of file logger.c.
References AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and ast_verb_update().
Referenced by ast_verb_console_unregister(), and verb_console_free().
|
static |
|
static |
|
static |
Definition at line 1673 of file logger.c.
Referenced by ast_log_full(), callid_group_remove_filters(), callid_group_set_filter(), and callid_logging_enabled().
|
static |
Definition at line 1663 of file logger.c.
Referenced by callid_set_chanloggroup(), and get_callid_group().
struct chan_group_lock_list chan_group_lock_list = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
|
static |
Definition at line 1891 of file logger.c.
Referenced by close_logger(), and init_logger().
|
static |
Definition at line 199 of file logger.c.
Referenced by ast_log_full(), close_logger(), and logger_thread().
|
static |
Colors used in the console for logging.
Definition at line 234 of file logger.c.
Referenced by format_log_default().
|
static |
Custom dynamic logging levels added by the user.
The first 16 levels are reserved for system usage, and the remaining levels are reserved for usage by dynamic levels registered via ast_logger_register_level.
Definition at line 231 of file logger.c.
Referenced by init_logger_chain().
|
static |
Definition at line 81 of file logger.c.
Referenced by ast_init_logger_for_socket_console(), ast_logger_get_dateformat(), build_device(), format_log_message_ap(), init_logger_chain(), and make_logchannel().
|
static |
Definition at line 91 of file logger.c.
Referenced by format_log_message_ap(), and init_logger_chain().
|
static |
Definition at line 84 of file logger.c.
Referenced by init_logger_chain(), and rotate_file().
|
static |
Definition at line 86 of file logger.c.
Referenced by _handle_SIGXFSZ(), logger_print_normal(), and reload_logger().
|
static |
Definition at line 87 of file logger.c.
Referenced by ast_logger_create_channel(), init_logger_chain(), logger_unregister_level(), and update_logchannels().
|
static |
Definition at line 1910 of file logger.c.
Referenced by init_logger().
|
static |
Definition at line 98 of file logger.c.
Referenced by ast_log_full(), and logger_thread().
|
static |
Definition at line 119 of file logger.c.
Referenced by ast_get_ip(), ast_get_ip_or_srv(), ast_get_ip_or_srv_with_preference(), ast_remotecontrol(), asterisk_daemon(), cli_prompt(), iax2_append_register(), iax2_register(), init_logger_chain(), load_asterisk_conf(), make_filename(), manager_login(), netconsole(), and tds_load_module().
|
static |
Logging channels used in the Asterisk logging system.
The first 16 levels are reserved for system usage, and the remaining levels are reserved for usage by dynamic levels registered via ast_logger_register_level.
Definition at line 214 of file logger.c.
Referenced by ast_logger_get_channels(), ast_network_puts_mutable(), custom_level_still_exists(), format_log_default(), format_log_message_ap(), format_log_plain(), handle_logger_set_level(), handle_logger_show_channels(), handle_logger_show_levels(), init_logger_chain(), logger_get_dynamic_level(), logger_register_level(), logger_unregister_level(), and make_components().
|
static |
Definition at line 273 of file logger.c.
Referenced by format_log_message_ap().
|
static |
Definition at line 1801 of file logger.c.
Referenced by close_logger(), and init_logger().
|
static |
|
static |
Definition at line 198 of file logger.c.
Referenced by ast_log_full(), close_logger(), init_logger(), and logger_thread().
struct { ... } logfiles |
Referenced by ast_queue_log(), init_logger_chain(), logger_queue_init(), logger_queue_rt_start(), and reload_logger().
|
static |
Definition at line 453 of file logger.c.
Referenced by make_components().
|
static |
Definition at line 331 of file logger.c.
Referenced by make_components().
|
static |
Definition at line 503 of file logger.c.
Referenced by make_components().
|
static |
Definition at line 89 of file logger.c.
Referenced by ast_is_logger_initialized(), ast_queue_log(), close_logger(), init_logger(), and logger_queue_start().
|
static |
Definition at line 97 of file logger.c.
Referenced by ast_log_full(), and logger_thread().
|
static |
Definition at line 96 of file logger.c.
Referenced by ast_log_full(), ast_logger_get_queue_limit(), ast_logger_set_queue_limit(), handle_logger_show_channels(), and init_logger_chain().
|
static |
Definition at line 95 of file logger.c.
Referenced by ast_log_full(), and logger_thread().
|
static |
|
static |
Definition at line 197 of file logger.c.
Referenced by ast_log_full(), close_logger(), and init_logger().
|
static |
Definition at line 2644 of file logger.c.
Referenced by ast_verb_console_get(), ast_verb_console_register(), ast_verb_console_set(), and ast_verb_console_unregister().
|
static |
Definition at line 90 of file logger.c.
Referenced by ast_create_callid().
|
static |
Definition at line 201 of file logger.c.
Referenced by ast_queue_log(), close_logger(), init_logger_chain(), logger_queue_init(), logger_queue_restart(), and reload_logger().
|
static |
Definition at line 83 of file logger.c.
Referenced by init_logger_chain(), logger_queue_init(), and logger_queue_restart().
|
static |
Definition at line 88 of file logger.c.
Referenced by ast_queue_log(), and logger_queue_start().
|
static |
|
static |
Definition at line 93 of file logger.c.
Referenced by ast_callid_threadassoc_add(), ast_callid_threadassoc_change(), ast_callid_threadassoc_remove(), and ast_read_threadstorage_callid().
|
static |
|
static |
ast_verb_update() reentrancy protection lock.
Definition at line 2582 of file logger.c.
Referenced by ast_verb_update().
|
static |
Definition at line 269 of file logger.c.
Referenced by logger_add_verbose_magic().
|
static |