Asterisk - The Open Source Telephony Project
21.4.1
|
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 |
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 | |
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. | |
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 | |
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. | |
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. | |
void | ast_verb_update (void) |
Re-evaluate the system max verbosity level (ast_verb_sys_level). | |
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. | |
static char * | handle_logger_show_levels (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command to show logging levels. | |
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. | |
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. | |
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 = "da6642af068ee5e6490c5b1d2cc1d238" , .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. | |
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 , } |
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_read_threadstorage_callid().
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.
|
static |
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(), and handle_showchan().
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(), and ast_threadstorage_get().
Referenced by __ast_pbx_run(), ast_callid_threadstorage_auto(), async_dial(), attended_transfer_monitor_thread(), bridge_channel_depart_thread(), bridge_channel_ind_thread(), jingle_action_hook(), and jingle_outgoing_hook().
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().
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().
Referenced by ast_callid_threadstorage_auto_clean(), attended_transfer_monitor_thread(), jingle_action_hook(), and jingle_outgoing_hook().
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(), and ast_read_threadstorage_callid().
Referenced by __analog_handle_event().
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().
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().
Referenced by __ast_pbx_run(), ast_callid_threadstorage_auto(), and jingle_alloc().
int ast_is_logger_initialized | ( | void | ) |
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.
Referenced by ast_callid_threadassoc_add(), ast_log_backtrace(), and init_logger().
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().
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(), and ast_threadstorage_set_ptr().
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_UNLOCK, AST_RWLIST_WRLOCK, find_logchannel(), logchannel::list, and logchannel::logmask.
Referenced by ast_ari_asterisk_add_log().
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 AST_LOGGER_ALLOC_ERROR, AST_LOGGER_FAILURE, AST_LOGGER_SUCCESS, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_reset(), logchannel::disabled, logchannel::filename, logchannel::list, logchannel::logmask, and logchannel::type.
Referenced by ast_ari_asterisk_list_log_channels().
const char* ast_logger_get_dateformat | ( | void | ) |
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, and AST_RWLIST_UNLOCK.
int ast_logger_get_queue_limit | ( | void | ) |
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, and AST_RWLIST_WRLOCK.
Referenced by 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_LOGGER_FAILURE, AST_LOGGER_SUCCESS, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, logchannel::dynamic, logchannel::fileptr, find_logchannel(), and logchannel::list.
Referenced by ast_ari_asterisk_delete_log().
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_LOGGER_FAILURE, AST_LOGGER_SUCCESS, ast_mkdir(), AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, logchannel::disabled, logchannel::filename, logchannel::fileptr, init_logger_chain(), logchannel::list, make_filename(), and manager_event.
Referenced by ast_ari_asterisk_rotate_log().
void ast_logger_set_queue_limit | ( | int | queue_limit | ) |
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, and AST_RWLIST_WRLOCK.
Referenced by unload_module().
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().
Referenced by __ast_pbx_run(), __ast_verbose(), ast_callid_threadstorage_auto(), ast_dial_run(), ast_log_safe(), jingle_alloc(), and local_request_with_stream_topology().
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(), verb_console::level, and option_verbose.
Referenced by handle_show_settings().
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_UNLOCK, AST_RWLIST_WRLOCK, ast_threadstorage_get(), ast_verb_update(), and verb_console::level.
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(), verb_console::level, and option_verbose.
void close_logger | ( | void | ) |
Provided by logger.c
Definition at line 2245 of file logger.c.
References ast_cli_unregister_multiple(), ast_custom_function_unregister(), AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, logchannel::fileptr, and logchannel::list.
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 logchannel::filename, logchannel::list, and make_filename().
Referenced by ast_logger_create_channel(), and ast_logger_remove_channel().
int init_logger | ( | void | ) |
Provided by logger.c
Definition at line 2202 of file logger.c.
References ast_cli_register_multiple, ast_custom_function_register, ast_log(), ast_mkdir(), AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb_update(), init_logger_chain(), and logger_thread().
|
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 ast_config_destroy(), ast_config_load2(), ast_console_puts_mutable(), ast_copy_string(), ast_strdupa, ast_true(), custom_level_still_exists(), logchannel::list, logchannel::logmask, ast_variable::name, ast_variable::next, S_OR, and ast_variable::value.
Referenced by ast_logger_rotate_channel(), and init_logger().
void logger_queue_start | ( | void | ) |
Start the ast_queue_log() logger.
Definition at line 2186 of file logger.c.
References AST_RWLIST_UNLOCK, and AST_RWLIST_WRLOCK.
|
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_copy_string().
Referenced by ast_logger_rotate_channel(), ast_read_image(), and find_logchannel().
|
static |
|
static |
|
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_network_puts_mutable().
|
static |
|
static |
|
static |
|
static |
|
static |
ast_verb_update() reentrancy protection lock.
Definition at line 2582 of file logger.c.
Referenced by ast_verb_update().