2017-01-06 07:10:15 +00:00
|
|
|
/*
|
2006-04-11 21:13:44 +00:00
|
|
|
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
2014-02-05 21:02:28 +00:00
|
|
|
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
2006-04-11 21:13:44 +00:00
|
|
|
*
|
|
|
|
* Version: MPL 1.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
2009-02-04 21:20:54 +00:00
|
|
|
* Anthony Minessale II <anthm@freeswitch.org>
|
2006-04-11 21:13:44 +00:00
|
|
|
* Portions created by the Initial Developer are Copyright (C)
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2017-01-06 07:10:15 +00:00
|
|
|
*
|
2009-02-04 21:20:54 +00:00
|
|
|
* Anthony Minessale II <anthm@freeswitch.org>
|
2006-04-11 21:13:44 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* switch_log.c -- Logging
|
|
|
|
*
|
|
|
|
*/
|
2008-01-27 17:42:51 +00:00
|
|
|
|
2006-04-11 21:13:44 +00:00
|
|
|
#include <switch.h>
|
2007-10-03 23:43:01 +00:00
|
|
|
#include "private/switch_core_pvt.h"
|
2007-10-04 21:15:08 +00:00
|
|
|
|
2006-04-11 21:13:44 +00:00
|
|
|
static const char *LEVELS[] = {
|
2007-10-04 17:25:06 +00:00
|
|
|
"CONSOLE",
|
2007-03-29 22:31:56 +00:00
|
|
|
"ALERT",
|
|
|
|
"CRIT",
|
|
|
|
"ERR",
|
|
|
|
"WARNING",
|
|
|
|
"NOTICE",
|
|
|
|
"INFO",
|
|
|
|
"DEBUG",
|
2006-04-12 17:51:47 +00:00
|
|
|
NULL
|
2006-04-11 21:13:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct switch_log_binding {
|
2006-04-29 23:43:28 +00:00
|
|
|
switch_log_function_t function;
|
|
|
|
switch_log_level_t level;
|
2008-07-11 14:35:08 +00:00
|
|
|
int is_console;
|
2006-04-11 21:13:44 +00:00
|
|
|
struct switch_log_binding *next;
|
|
|
|
};
|
|
|
|
|
2006-05-10 03:23:05 +00:00
|
|
|
typedef struct switch_log_binding switch_log_binding_t;
|
2006-04-11 21:13:44 +00:00
|
|
|
|
2006-04-29 01:00:52 +00:00
|
|
|
static switch_memory_pool_t *LOG_POOL = NULL;
|
2006-05-10 03:23:05 +00:00
|
|
|
static switch_log_binding_t *BINDINGS = NULL;
|
2006-04-11 21:13:44 +00:00
|
|
|
static switch_mutex_t *BINDLOCK = NULL;
|
|
|
|
static switch_queue_t *LOG_QUEUE = NULL;
|
2009-02-26 22:30:00 +00:00
|
|
|
#ifdef SWITCH_LOG_RECYCLE
|
2007-09-30 20:05:18 +00:00
|
|
|
static switch_queue_t *LOG_RECYCLE_QUEUE = NULL;
|
2009-02-26 22:30:00 +00:00
|
|
|
#endif
|
2006-04-11 21:13:44 +00:00
|
|
|
static int8_t THREAD_RUNNING = 0;
|
|
|
|
static uint8_t MAX_LEVEL = 0;
|
2008-07-11 14:35:08 +00:00
|
|
|
static int mods_loaded = 0;
|
2008-07-15 14:56:30 +00:00
|
|
|
static int console_mods_loaded = 0;
|
2008-07-11 14:35:08 +00:00
|
|
|
static switch_bool_t COLORIZE = SWITCH_FALSE;
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
static HANDLE hStdout;
|
|
|
|
static WORD wOldColorAttrs;
|
|
|
|
static CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
|
2008-07-14 17:09:47 +00:00
|
|
|
|
2010-02-06 03:38:24 +00:00
|
|
|
static WORD
|
2008-07-11 14:35:08 +00:00
|
|
|
#else
|
2010-02-06 03:38:24 +00:00
|
|
|
static const char *
|
2008-07-11 14:35:08 +00:00
|
|
|
#endif
|
2017-01-06 07:10:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-06 03:38:24 +00:00
|
|
|
COLORS[] =
|
|
|
|
{ SWITCH_SEQ_DEFAULT_COLOR, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FMAGEN, SWITCH_SEQ_FCYAN, SWITCH_SEQ_FGREEN,
|
|
|
|
SWITCH_SEQ_FYELLOW };
|
2006-04-11 21:13:44 +00:00
|
|
|
|
2009-08-18 18:32:11 +00:00
|
|
|
|
2019-05-30 16:37:04 +00:00
|
|
|
SWITCH_DECLARE(cJSON *) switch_log_node_to_json(const switch_log_node_t *node, int log_level, switch_log_json_format_t *json_format, switch_event_t *chan_vars)
|
|
|
|
{
|
|
|
|
cJSON *json = cJSON_CreateObject();
|
|
|
|
char *hostname;
|
|
|
|
char *full_message = node->content;
|
|
|
|
char *parsed_full_message = NULL;
|
|
|
|
char *field_name = NULL;
|
|
|
|
switch_event_t *log_fields = NULL;
|
|
|
|
switch_core_session_t *session = NULL;
|
|
|
|
|
|
|
|
if (json_format->version.name && json_format->version.value) {
|
|
|
|
cJSON_AddItemToObject(json, json_format->version.name, cJSON_CreateString(json_format->version.value));
|
|
|
|
}
|
|
|
|
if (json_format->host.name) {
|
|
|
|
if (json_format->host.value) {
|
|
|
|
cJSON_AddItemToObject(json, json_format->host.name, cJSON_CreateString(json_format->host.value));
|
|
|
|
} else if ((hostname = switch_core_get_variable("hostname")) && !zstr(hostname)) {
|
|
|
|
cJSON_AddItemToObject(json, json_format->host.name, cJSON_CreateString(hostname));
|
|
|
|
} else if ((hostname = switch_core_get_variable("local_ip_v4")) && !zstr(hostname)) {
|
|
|
|
cJSON_AddItemToObject(json, json_format->host.name, cJSON_CreateString(hostname));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (json_format->timestamp.name) {
|
|
|
|
double timestamp = node->timestamp;
|
|
|
|
if (json_format->timestamp_divisor > 1.0) {
|
2019-05-31 14:08:33 +00:00
|
|
|
timestamp = timestamp / json_format->timestamp_divisor;
|
2019-05-30 16:37:04 +00:00
|
|
|
}
|
|
|
|
cJSON_AddItemToObject(json, json_format->timestamp.name, cJSON_CreateNumber(timestamp));
|
|
|
|
}
|
|
|
|
if (json_format->level.name) {
|
|
|
|
cJSON_AddItemToObject(json, json_format->level.name, cJSON_CreateNumber(log_level));
|
|
|
|
}
|
|
|
|
if (json_format->ident.name) {
|
|
|
|
if (json_format->ident.value) {
|
|
|
|
cJSON_AddItemToObject(json, json_format->ident.name, cJSON_CreateString(json_format->ident.value));
|
|
|
|
} else {
|
|
|
|
cJSON_AddItemToObject(json, json_format->ident.name, cJSON_CreateString("freeswitch"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (json_format->pid.name) {
|
|
|
|
if (json_format->pid.value) {
|
|
|
|
cJSON_AddItemToObject(json, json_format->pid.name, cJSON_CreateNumber(atoi(json_format->pid.value)));
|
|
|
|
} else {
|
|
|
|
cJSON_AddItemToObject(json, json_format->pid.name, cJSON_CreateNumber((int)getpid()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (json_format->uuid.name && !zstr(node->userdata)) {
|
|
|
|
cJSON_AddItemToObject(json, json_format->uuid.name, cJSON_CreateString(node->userdata));
|
|
|
|
}
|
|
|
|
if (json_format->file.name && !zstr_buf(node->file)) {
|
|
|
|
cJSON_AddItemToObject(json, json_format->file.name, cJSON_CreateString(node->file));
|
|
|
|
if (json_format->line.name) {
|
|
|
|
cJSON_AddItemToObject(json, json_format->line.name, cJSON_CreateNumber(node->line));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (json_format->function.name && !zstr_buf(node->func)) {
|
|
|
|
cJSON_AddItemToObject(json, json_format->function.name, cJSON_CreateString(node->func));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* skip initial space and new line */
|
|
|
|
if (*full_message == ' ') {
|
|
|
|
full_message++;
|
|
|
|
}
|
|
|
|
if (*full_message == '\n') {
|
|
|
|
full_message++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get fields from log tags */
|
|
|
|
if (node->tags) {
|
|
|
|
switch_event_dup(&log_fields, node->tags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get fields from channel data, if configured */
|
|
|
|
if (!zstr(node->userdata) && chan_vars && chan_vars->headers && (session = switch_core_session_locate(node->userdata))) {
|
|
|
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
|
|
|
switch_event_header_t *hp;
|
|
|
|
/* session_fields name mapped to variable name */
|
|
|
|
for (hp = chan_vars->headers; hp; hp = hp->next) {
|
|
|
|
if (!zstr(hp->name) && !zstr(hp->value)) {
|
|
|
|
const char *val = switch_channel_get_variable(channel, hp->value);
|
|
|
|
if (!zstr(val)) {
|
|
|
|
if (!log_fields) {
|
|
|
|
switch_event_create_plain(&log_fields, SWITCH_EVENT_CHANNEL_DATA);
|
|
|
|
}
|
|
|
|
switch_event_add_header_string(log_fields, SWITCH_STACK_BOTTOM, hp->name, val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switch_core_session_rwunlock(session);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* parse list of fields from message text, if any */
|
|
|
|
if (strncmp(full_message, "LOG_FIELDS", 10) == 0) {
|
|
|
|
switch_event_create_brackets(full_message+10, '[', ']', ',', &log_fields, &parsed_full_message, SWITCH_TRUE);
|
|
|
|
full_message = parsed_full_message;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* add additional fields */
|
|
|
|
if (log_fields) {
|
|
|
|
switch_event_header_t *hp;
|
|
|
|
const char *prefix = json_format->custom_field_prefix ? json_format->custom_field_prefix : "";
|
|
|
|
for (hp = log_fields->headers; hp; hp = hp->next) {
|
|
|
|
if (!zstr(hp->name) && !zstr(hp->value)) {
|
|
|
|
if (strncmp(hp->name, "@#", 2) == 0) {
|
|
|
|
field_name = switch_mprintf("%s%s", prefix, hp->name + 2);
|
|
|
|
cJSON_AddItemToObject(json, field_name, cJSON_CreateNumber(strtod(hp->value, NULL)));
|
|
|
|
} else {
|
|
|
|
field_name = switch_mprintf("%s%s", prefix, hp->name);
|
|
|
|
cJSON_AddItemToObject(json, field_name, cJSON_CreateString(hp->value));
|
|
|
|
}
|
|
|
|
free(field_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switch_event_destroy(&log_fields);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (json_format->full_message.name) {
|
|
|
|
cJSON_AddItemToObject(json, json_format->full_message.name, cJSON_CreateString(full_message));
|
|
|
|
} else {
|
|
|
|
cJSON_AddItemToObject(json, "message", cJSON_CreateString(full_message));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (json_format->short_message.name) {
|
|
|
|
char short_message[151];
|
|
|
|
char *short_message_end = NULL;
|
|
|
|
switch_snprintf(short_message, sizeof(short_message) - 1, "%s", full_message);
|
|
|
|
if ((short_message_end = strchr(short_message, '\n'))) {
|
|
|
|
*short_message_end = '\0';
|
|
|
|
}
|
|
|
|
cJSON_AddItemToObject(json, json_format->short_message.name, cJSON_CreateString(short_message));
|
|
|
|
}
|
|
|
|
|
|
|
|
switch_safe_free(parsed_full_message);
|
|
|
|
|
|
|
|
return json;
|
|
|
|
}
|
|
|
|
|
2010-02-06 03:38:24 +00:00
|
|
|
static switch_log_node_t *switch_log_node_alloc()
|
2009-08-18 18:32:11 +00:00
|
|
|
{
|
|
|
|
switch_log_node_t *node = NULL;
|
|
|
|
#ifdef SWITCH_LOG_RECYCLE
|
|
|
|
void *pop = NULL;
|
|
|
|
|
|
|
|
if (switch_queue_trypop(LOG_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
|
|
|
|
node = (switch_log_node_t *) pop;
|
|
|
|
} else {
|
|
|
|
#endif
|
|
|
|
node = malloc(sizeof(*node));
|
|
|
|
switch_assert(node);
|
|
|
|
#ifdef SWITCH_LOG_RECYCLE
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2010-02-06 03:38:24 +00:00
|
|
|
SWITCH_DECLARE(switch_log_node_t *) switch_log_node_dup(const switch_log_node_t *node)
|
2009-08-22 19:26:58 +00:00
|
|
|
{
|
|
|
|
switch_log_node_t *newnode = switch_log_node_alloc();
|
2010-02-06 03:38:24 +00:00
|
|
|
|
2009-08-22 19:26:58 +00:00
|
|
|
*newnode = *node;
|
2019-03-07 01:54:57 +00:00
|
|
|
newnode->content = NULL;
|
2010-02-06 03:38:24 +00:00
|
|
|
|
2019-03-07 01:54:57 +00:00
|
|
|
if (node->data) {
|
2010-02-06 03:38:24 +00:00
|
|
|
newnode->data = strdup(node->data);
|
2019-03-07 01:54:57 +00:00
|
|
|
switch_assert(newnode->data);
|
|
|
|
|
|
|
|
// content is a pointer inside data; need to calculate the new pointer
|
|
|
|
if (node->content && node->content >= node->data) {
|
|
|
|
newnode->content = newnode->data + (node->content - node->data);
|
|
|
|
}
|
2009-08-22 19:26:58 +00:00
|
|
|
}
|
2010-02-06 03:38:24 +00:00
|
|
|
|
2019-03-07 01:54:57 +00:00
|
|
|
if (node->userdata) {
|
2009-08-22 19:26:58 +00:00
|
|
|
newnode->userdata = strdup(node->userdata);
|
2019-03-07 01:54:57 +00:00
|
|
|
switch_assert(newnode->userdata);
|
2009-08-22 19:26:58 +00:00
|
|
|
}
|
2010-02-06 03:38:24 +00:00
|
|
|
|
2019-03-07 15:26:34 +00:00
|
|
|
if (node->tags) {
|
|
|
|
switch_event_dup(&newnode->tags, node->tags);
|
|
|
|
}
|
|
|
|
|
2009-08-22 19:26:58 +00:00
|
|
|
return newnode;
|
|
|
|
}
|
|
|
|
|
|
|
|
SWITCH_DECLARE(void) switch_log_node_free(switch_log_node_t **pnode)
|
2009-08-18 18:32:11 +00:00
|
|
|
{
|
|
|
|
switch_log_node_t *node;
|
2010-02-06 03:38:24 +00:00
|
|
|
|
2009-08-18 18:32:11 +00:00
|
|
|
if (!pnode) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
node = *pnode;
|
|
|
|
|
2010-02-06 03:38:24 +00:00
|
|
|
if (node) {
|
|
|
|
switch_safe_free(node->userdata);
|
2009-08-18 18:32:11 +00:00
|
|
|
switch_safe_free(node->data);
|
2019-03-07 15:26:34 +00:00
|
|
|
if (node->tags) {
|
|
|
|
switch_event_destroy(&node->tags);
|
|
|
|
}
|
2009-08-18 18:32:11 +00:00
|
|
|
#ifdef SWITCH_LOG_RECYCLE
|
|
|
|
if (switch_queue_trypush(LOG_RECYCLE_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
|
|
|
|
free(node);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
free(node);
|
|
|
|
#endif
|
|
|
|
}
|
2010-02-06 03:38:24 +00:00
|
|
|
*pnode = NULL;
|
2009-08-18 18:32:11 +00:00
|
|
|
}
|
|
|
|
|
2006-04-29 23:43:28 +00:00
|
|
|
SWITCH_DECLARE(const char *) switch_log_level2str(switch_log_level_t level)
|
2006-04-12 17:51:47 +00:00
|
|
|
{
|
2007-10-04 17:25:06 +00:00
|
|
|
if (level > SWITCH_LOG_DEBUG) {
|
|
|
|
level = SWITCH_LOG_DEBUG;
|
|
|
|
}
|
2006-04-12 17:51:47 +00:00
|
|
|
return LEVELS[level];
|
|
|
|
}
|
|
|
|
|
2007-12-05 20:24:20 +00:00
|
|
|
SWITCH_DECLARE(uint32_t) switch_log_str2mask(const char *str)
|
|
|
|
{
|
|
|
|
int argc = 0, x = 0;
|
|
|
|
char *argv[10] = { 0 };
|
|
|
|
uint32_t mask = 0;
|
|
|
|
char *p = strdup(str);
|
2020-01-31 23:28:25 +00:00
|
|
|
switch_log_level_t level = SWITCH_LOG_INVALID;
|
2007-12-05 20:24:20 +00:00
|
|
|
|
2007-12-11 19:23:57 +00:00
|
|
|
switch_assert(p);
|
2007-12-05 20:24:20 +00:00
|
|
|
|
|
|
|
if ((argc = switch_separate_string(p, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
|
2007-12-11 21:31:57 +00:00
|
|
|
for (x = 0; x < argc && argv[x]; x++) {
|
2007-12-05 20:24:20 +00:00
|
|
|
if (!strcasecmp(argv[x], "all")) {
|
|
|
|
mask = 0xFF;
|
|
|
|
break;
|
|
|
|
} else {
|
2007-12-10 19:16:50 +00:00
|
|
|
level = switch_log_str2level(argv[x]);
|
|
|
|
if (level != SWITCH_LOG_INVALID) {
|
|
|
|
mask |= (1 << level);
|
|
|
|
}
|
2007-12-05 20:24:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
free(p);
|
|
|
|
|
|
|
|
return mask;
|
|
|
|
}
|
|
|
|
|
2006-04-29 23:43:28 +00:00
|
|
|
SWITCH_DECLARE(switch_log_level_t) switch_log_str2level(const char *str)
|
2006-04-12 17:51:47 +00:00
|
|
|
{
|
|
|
|
int x = 0;
|
2007-12-10 19:16:50 +00:00
|
|
|
switch_log_level_t level = SWITCH_LOG_INVALID;
|
2007-10-04 17:25:06 +00:00
|
|
|
|
2009-06-09 19:52:07 +00:00
|
|
|
if (switch_is_number(str)) {
|
|
|
|
x = atoi(str);
|
|
|
|
|
|
|
|
if (x > SWITCH_LOG_INVALID) {
|
2010-02-06 03:38:24 +00:00
|
|
|
return SWITCH_LOG_INVALID - 1;
|
2009-06-09 19:52:07 +00:00
|
|
|
} else if (x < 0) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-29 22:31:56 +00:00
|
|
|
for (x = 0;; x++) {
|
2006-04-12 17:51:47 +00:00
|
|
|
if (!LEVELS[x]) {
|
|
|
|
break;
|
|
|
|
}
|
2008-12-31 19:07:20 +00:00
|
|
|
|
2006-04-12 17:51:47 +00:00
|
|
|
if (!strcasecmp(LEVELS[x], str)) {
|
2006-04-29 23:43:28 +00:00
|
|
|
level = (switch_log_level_t) x;
|
2006-04-12 17:51:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return level;
|
|
|
|
}
|
|
|
|
|
2008-07-11 14:35:08 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_log_unbind_logger(switch_log_function_t function)
|
|
|
|
{
|
|
|
|
switch_log_binding_t *ptr = NULL, *last = NULL;
|
|
|
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
|
|
|
|
|
|
|
switch_mutex_lock(BINDLOCK);
|
|
|
|
for (ptr = BINDINGS; ptr; ptr = ptr->next) {
|
|
|
|
if (ptr->function == function) {
|
|
|
|
if (last) {
|
|
|
|
last->next = ptr->next;
|
|
|
|
} else {
|
|
|
|
BINDINGS = ptr->next;
|
|
|
|
}
|
|
|
|
status = SWITCH_STATUS_SUCCESS;
|
2008-07-15 14:56:30 +00:00
|
|
|
mods_loaded--;
|
2008-07-11 14:35:08 +00:00
|
|
|
if (ptr->is_console) {
|
2008-07-15 14:56:30 +00:00
|
|
|
console_mods_loaded--;
|
2008-07-11 14:35:08 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
last = ptr;
|
|
|
|
}
|
|
|
|
switch_mutex_unlock(BINDLOCK);
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(switch_log_function_t function, switch_log_level_t level, switch_bool_t is_console)
|
2006-04-11 21:13:44 +00:00
|
|
|
{
|
2006-05-10 03:23:05 +00:00
|
|
|
switch_log_binding_t *binding = NULL, *ptr = NULL;
|
2007-12-11 19:23:57 +00:00
|
|
|
switch_assert(function != NULL);
|
2006-04-11 21:13:44 +00:00
|
|
|
|
|
|
|
if (!(binding = switch_core_alloc(LOG_POOL, sizeof(*binding)))) {
|
|
|
|
return SWITCH_STATUS_MEMERR;
|
|
|
|
}
|
|
|
|
|
2007-03-29 22:31:56 +00:00
|
|
|
if ((uint8_t) level > MAX_LEVEL) {
|
2006-04-11 21:13:44 +00:00
|
|
|
MAX_LEVEL = level;
|
|
|
|
}
|
|
|
|
|
|
|
|
binding->function = function;
|
|
|
|
binding->level = level;
|
2008-07-11 14:35:08 +00:00
|
|
|
binding->is_console = is_console;
|
2006-04-11 21:13:44 +00:00
|
|
|
|
|
|
|
switch_mutex_lock(BINDLOCK);
|
|
|
|
for (ptr = BINDINGS; ptr && ptr->next; ptr = ptr->next);
|
|
|
|
|
|
|
|
if (ptr) {
|
|
|
|
ptr->next = binding;
|
|
|
|
} else {
|
|
|
|
BINDINGS = binding;
|
|
|
|
}
|
2008-07-11 14:35:08 +00:00
|
|
|
if (is_console) {
|
2008-07-15 14:56:30 +00:00
|
|
|
console_mods_loaded++;
|
2008-07-11 14:35:08 +00:00
|
|
|
}
|
2008-07-15 14:56:30 +00:00
|
|
|
mods_loaded++;
|
2006-04-11 21:13:44 +00:00
|
|
|
switch_mutex_unlock(BINDLOCK);
|
|
|
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2009-02-20 01:10:59 +00:00
|
|
|
static switch_thread_t *thread;
|
|
|
|
|
2009-02-20 18:04:57 +00:00
|
|
|
static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *t, void *obj)
|
2006-04-11 21:13:44 +00:00
|
|
|
{
|
|
|
|
|
2007-05-25 20:39:13 +00:00
|
|
|
if (!obj) {
|
|
|
|
obj = NULL;
|
|
|
|
}
|
2006-04-11 21:13:44 +00:00
|
|
|
THREAD_RUNNING = 1;
|
|
|
|
|
2007-03-29 22:31:56 +00:00
|
|
|
while (THREAD_RUNNING == 1) {
|
2006-04-11 21:13:44 +00:00
|
|
|
void *pop = NULL;
|
2006-04-29 23:43:28 +00:00
|
|
|
switch_log_node_t *node = NULL;
|
2006-05-10 03:23:05 +00:00
|
|
|
switch_log_binding_t *binding;
|
2007-03-29 22:31:56 +00:00
|
|
|
|
2006-04-11 21:13:44 +00:00
|
|
|
if (switch_queue_pop(LOG_QUEUE, &pop) != SWITCH_STATUS_SUCCESS) {
|
|
|
|
break;
|
|
|
|
}
|
2007-03-29 22:31:56 +00:00
|
|
|
|
2006-04-11 21:13:44 +00:00
|
|
|
if (!pop) {
|
2012-06-28 15:10:13 +00:00
|
|
|
THREAD_RUNNING = -1;
|
2006-04-11 21:13:44 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-03-29 22:31:56 +00:00
|
|
|
|
2006-04-29 23:43:28 +00:00
|
|
|
node = (switch_log_node_t *) pop;
|
2006-04-11 21:13:44 +00:00
|
|
|
switch_mutex_lock(BINDLOCK);
|
2007-03-29 22:31:56 +00:00
|
|
|
for (binding = BINDINGS; binding; binding = binding->next) {
|
2006-04-11 21:13:44 +00:00
|
|
|
if (binding->level >= node->level) {
|
2006-04-12 14:41:35 +00:00
|
|
|
binding->function(node, node->level);
|
2006-04-11 21:13:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
switch_mutex_unlock(BINDLOCK);
|
2008-05-27 04:30:03 +00:00
|
|
|
|
2009-08-21 22:20:31 +00:00
|
|
|
switch_log_node_free(&node);
|
2009-08-22 19:26:58 +00:00
|
|
|
|
2006-04-11 21:13:44 +00:00
|
|
|
}
|
2006-04-26 19:11:49 +00:00
|
|
|
|
2006-04-11 21:13:44 +00:00
|
|
|
THREAD_RUNNING = 0;
|
|
|
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Logger Ended.\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-03-29 22:31:56 +00:00
|
|
|
SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
|
2007-06-20 09:19:45 +00:00
|
|
|
const char *userdata, switch_log_level_t level, const char *fmt, ...)
|
2009-03-04 18:54:43 +00:00
|
|
|
{
|
|
|
|
va_list ap;
|
2010-02-06 03:38:24 +00:00
|
|
|
|
2009-03-04 18:54:43 +00:00
|
|
|
va_start(ap, fmt);
|
|
|
|
switch_log_vprintf(channel, file, func, line, userdata, level, fmt, ap);
|
2010-02-06 03:38:24 +00:00
|
|
|
va_end(ap);
|
2009-03-04 18:54:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define do_mods (LOG_QUEUE && THREAD_RUNNING)
|
|
|
|
SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const char *file, const char *func, int line,
|
2010-02-06 03:38:24 +00:00
|
|
|
const char *userdata, switch_log_level_t level, const char *fmt, va_list ap)
|
2006-04-11 21:13:44 +00:00
|
|
|
{
|
|
|
|
char *data = NULL;
|
|
|
|
char *new_fmt = NULL;
|
|
|
|
int ret = 0;
|
|
|
|
FILE *handle;
|
2007-03-29 22:31:56 +00:00
|
|
|
const char *filep = (file ? switch_cut_path(file) : "");
|
2006-11-10 16:30:02 +00:00
|
|
|
const char *funcp = (func ? func : "");
|
2006-04-12 14:41:35 +00:00
|
|
|
char *content = NULL;
|
2009-01-25 21:23:07 +00:00
|
|
|
switch_time_t now = switch_micro_time_now();
|
2006-04-11 21:13:44 +00:00
|
|
|
uint32_t len;
|
2009-08-27 16:04:00 +00:00
|
|
|
#ifdef SWITCH_FUNC_IN_LOG
|
|
|
|
const char *extra_fmt = "%s [%s] %s:%d %s()%c%s";
|
|
|
|
#else
|
2009-06-05 19:49:19 +00:00
|
|
|
const char *extra_fmt = "%s [%s] %s:%d%c%s";
|
2009-08-27 16:04:00 +00:00
|
|
|
#endif
|
2010-01-20 19:19:48 +00:00
|
|
|
switch_log_level_t limit_level = runtime.hard_log_level;
|
2012-10-11 17:44:31 +00:00
|
|
|
switch_log_level_t special_level = SWITCH_LOG_UNINIT;
|
2010-01-20 19:19:48 +00:00
|
|
|
|
|
|
|
if (channel == SWITCH_CHANNEL_ID_SESSION && userdata) {
|
2010-02-06 03:38:24 +00:00
|
|
|
switch_core_session_t *session = (switch_core_session_t *) userdata;
|
2012-10-11 17:44:31 +00:00
|
|
|
special_level = session->loglevel;
|
2010-01-20 19:19:48 +00:00
|
|
|
if (limit_level < session->loglevel) {
|
|
|
|
limit_level = session->loglevel;
|
|
|
|
}
|
|
|
|
}
|
2007-09-30 20:05:18 +00:00
|
|
|
|
2009-11-20 23:12:07 +00:00
|
|
|
if (level > 100) {
|
2010-02-06 03:38:24 +00:00
|
|
|
if ((uint32_t) (level - 100) > runtime.debug_level) {
|
2009-11-20 23:12:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-10-23 22:14:27 +00:00
|
|
|
level = 1;
|
2009-11-20 23:12:07 +00:00
|
|
|
}
|
|
|
|
|
2010-01-20 19:19:48 +00:00
|
|
|
if (level > limit_level) {
|
2007-10-03 23:43:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-07-14 14:55:03 +00:00
|
|
|
switch_assert(level < SWITCH_LOG_INVALID);
|
|
|
|
|
2006-04-11 21:13:44 +00:00
|
|
|
handle = switch_core_data_channel(channel);
|
|
|
|
|
|
|
|
if (channel != SWITCH_CHANNEL_ID_LOG_CLEAN) {
|
|
|
|
char date[80] = "";
|
2009-06-05 19:49:19 +00:00
|
|
|
//switch_size_t retsize;
|
2006-04-11 21:13:44 +00:00
|
|
|
switch_time_exp_t tm;
|
|
|
|
|
2006-04-12 14:41:35 +00:00
|
|
|
switch_time_exp_lt(&tm, now);
|
2010-02-06 03:38:24 +00:00
|
|
|
switch_snprintf(date, sizeof(date), "%0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.6d",
|
|
|
|
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec);
|
2007-03-29 22:31:56 +00:00
|
|
|
|
2009-06-05 19:49:19 +00:00
|
|
|
//switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
|
|
|
|
|
2009-08-27 16:04:00 +00:00
|
|
|
#ifdef SWITCH_FUNC_IN_LOG
|
|
|
|
len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(funcp) + strlen(fmt));
|
|
|
|
#else
|
2009-06-05 19:49:19 +00:00
|
|
|
len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(fmt));
|
2009-08-27 16:04:00 +00:00
|
|
|
#endif
|
2007-03-29 22:31:56 +00:00
|
|
|
new_fmt = malloc(len + 1);
|
2007-12-11 21:31:57 +00:00
|
|
|
switch_assert(new_fmt);
|
2009-08-27 16:04:00 +00:00
|
|
|
#ifdef SWITCH_FUNC_IN_LOG
|
|
|
|
switch_snprintf(new_fmt, len, extra_fmt, date, switch_log_level2str(level), filep, line, funcp, 128, fmt);
|
|
|
|
#else
|
2009-06-05 19:49:19 +00:00
|
|
|
switch_snprintf(new_fmt, len, extra_fmt, date, switch_log_level2str(level), filep, line, 128, fmt);
|
2009-08-27 16:04:00 +00:00
|
|
|
#endif
|
|
|
|
|
2006-04-11 21:13:44 +00:00
|
|
|
fmt = new_fmt;
|
|
|
|
}
|
|
|
|
|
2007-03-09 20:44:13 +00:00
|
|
|
ret = switch_vasprintf(&data, fmt, ap);
|
2008-03-14 03:47:45 +00:00
|
|
|
|
2006-04-11 21:13:44 +00:00
|
|
|
if (ret == -1) {
|
|
|
|
fprintf(stderr, "Memory Error\n");
|
2008-03-14 03:47:45 +00:00
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (channel == SWITCH_CHANNEL_ID_LOG_CLEAN) {
|
|
|
|
content = data;
|
2006-04-11 21:13:44 +00:00
|
|
|
} else {
|
2008-03-14 03:47:45 +00:00
|
|
|
if ((content = strchr(data, 128))) {
|
|
|
|
*content = ' ';
|
|
|
|
}
|
|
|
|
}
|
2006-04-12 14:41:35 +00:00
|
|
|
|
2008-03-14 03:47:45 +00:00
|
|
|
if (channel == SWITCH_CHANNEL_ID_EVENT) {
|
|
|
|
switch_event_t *event;
|
|
|
|
if (switch_event_running() == SWITCH_STATUS_SUCCESS && switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) {
|
2008-08-16 02:17:09 +00:00
|
|
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-Data", data);
|
|
|
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-File", filep);
|
|
|
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-Function", funcp);
|
2008-03-14 03:47:45 +00:00
|
|
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Line", "%d", line);
|
|
|
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Level", "%d", (int) level);
|
2009-10-23 16:03:42 +00:00
|
|
|
if (!zstr(userdata)) {
|
2009-08-18 18:24:31 +00:00
|
|
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "User-Data", userdata);
|
|
|
|
}
|
2008-03-14 03:47:45 +00:00
|
|
|
switch_event_fire(&event);
|
|
|
|
data = NULL;
|
2006-04-12 14:41:35 +00:00
|
|
|
}
|
|
|
|
|
2008-03-14 03:47:45 +00:00
|
|
|
goto end;
|
|
|
|
}
|
2010-02-06 03:38:24 +00:00
|
|
|
|
2008-07-15 14:56:30 +00:00
|
|
|
if (console_mods_loaded == 0 || !do_mods) {
|
2008-03-14 03:47:45 +00:00
|
|
|
if (handle) {
|
|
|
|
int aok = 1;
|
2008-01-25 23:09:33 +00:00
|
|
|
#ifndef WIN32
|
|
|
|
|
2008-03-14 03:47:45 +00:00
|
|
|
fd_set can_write;
|
|
|
|
int fd;
|
|
|
|
struct timeval to;
|
2008-05-27 04:30:03 +00:00
|
|
|
|
2008-03-14 03:47:45 +00:00
|
|
|
fd = fileno(handle);
|
|
|
|
memset(&to, 0, sizeof(to));
|
2009-04-22 23:34:48 +00:00
|
|
|
FD_ZERO(&can_write);
|
2008-03-14 03:47:45 +00:00
|
|
|
FD_SET(fd, &can_write);
|
|
|
|
to.tv_sec = 0;
|
2008-05-24 05:09:50 +00:00
|
|
|
to.tv_usec = 100000;
|
2008-05-27 04:30:03 +00:00
|
|
|
if (select(fd + 1, NULL, &can_write, NULL, &to) > 0) {
|
2008-03-14 03:47:45 +00:00
|
|
|
aok = FD_ISSET(fd, &can_write);
|
|
|
|
} else {
|
|
|
|
aok = 0;
|
|
|
|
}
|
2008-01-25 23:09:33 +00:00
|
|
|
#endif
|
2008-03-14 03:47:45 +00:00
|
|
|
if (aok) {
|
2008-07-11 14:35:08 +00:00
|
|
|
if (COLORIZE) {
|
2008-07-14 13:44:25 +00:00
|
|
|
|
|
|
|
#ifdef WIN32
|
2008-07-14 14:55:03 +00:00
|
|
|
SetConsoleTextAttribute(hStdout, COLORS[level]);
|
|
|
|
WriteFile(hStdout, data, (DWORD) strlen(data), NULL, NULL);
|
2008-07-14 13:44:25 +00:00
|
|
|
SetConsoleTextAttribute(hStdout, wOldColorAttrs);
|
|
|
|
#else
|
2008-07-11 14:35:08 +00:00
|
|
|
fprintf(handle, "%s%s%s", COLORS[level], data, SWITCH_SEQ_DEFAULT_COLOR);
|
2008-07-14 13:44:25 +00:00
|
|
|
#endif
|
2008-07-11 14:35:08 +00:00
|
|
|
} else {
|
|
|
|
fprintf(handle, "%s", data);
|
|
|
|
}
|
2008-03-14 03:47:45 +00:00
|
|
|
}
|
|
|
|
}
|
2010-02-06 03:38:24 +00:00
|
|
|
}
|
2008-07-15 14:56:30 +00:00
|
|
|
|
|
|
|
if (do_mods && level <= MAX_LEVEL) {
|
2009-08-18 18:24:31 +00:00
|
|
|
switch_log_node_t *node = switch_log_node_alloc();
|
2010-02-06 03:38:24 +00:00
|
|
|
|
2008-03-14 03:47:45 +00:00
|
|
|
node->data = data;
|
|
|
|
data = NULL;
|
|
|
|
switch_set_string(node->file, filep);
|
|
|
|
switch_set_string(node->func, funcp);
|
|
|
|
node->line = line;
|
|
|
|
node->level = level;
|
2012-10-11 17:44:31 +00:00
|
|
|
node->slevel = special_level;
|
2008-03-14 03:47:45 +00:00
|
|
|
node->content = content;
|
|
|
|
node->timestamp = now;
|
2008-12-20 14:56:08 +00:00
|
|
|
node->channel = channel;
|
2019-03-07 15:26:34 +00:00
|
|
|
node->tags = NULL;
|
2010-01-20 19:19:48 +00:00
|
|
|
if (channel == SWITCH_CHANNEL_ID_SESSION) {
|
2012-10-11 17:44:31 +00:00
|
|
|
switch_core_session_t *session = (switch_core_session_t *) userdata;
|
|
|
|
node->userdata = userdata ? strdup(switch_core_session_get_uuid(session)) : NULL;
|
2019-03-07 15:26:34 +00:00
|
|
|
if (session) {
|
|
|
|
switch_channel_get_log_tags(switch_core_session_get_channel(session), &node->tags);
|
|
|
|
}
|
2010-01-20 19:19:48 +00:00
|
|
|
} else {
|
|
|
|
node->userdata = !zstr(userdata) ? strdup(userdata) : NULL;
|
|
|
|
}
|
2008-05-24 05:09:50 +00:00
|
|
|
|
2008-03-14 03:47:45 +00:00
|
|
|
if (switch_queue_trypush(LOG_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
|
2009-08-18 18:24:31 +00:00
|
|
|
switch_log_node_free(&node);
|
2006-04-11 21:13:44 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-27 04:30:03 +00:00
|
|
|
|
|
|
|
end:
|
2006-04-11 21:13:44 +00:00
|
|
|
|
2008-03-14 03:47:45 +00:00
|
|
|
switch_safe_free(data);
|
2007-09-30 20:05:18 +00:00
|
|
|
switch_safe_free(new_fmt);
|
2008-12-19 17:12:27 +00:00
|
|
|
|
2006-04-11 21:13:44 +00:00
|
|
|
}
|
|
|
|
|
2008-07-11 14:35:08 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool, switch_bool_t colorize)
|
2006-04-11 21:13:44 +00:00
|
|
|
{
|
2006-04-11 21:41:00 +00:00
|
|
|
switch_threadattr_t *thd_attr;;
|
2010-02-06 03:38:24 +00:00
|
|
|
|
2007-12-11 19:23:57 +00:00
|
|
|
switch_assert(pool != NULL);
|
2006-04-11 21:13:44 +00:00
|
|
|
|
|
|
|
LOG_POOL = pool;
|
|
|
|
|
|
|
|
switch_threadattr_create(&thd_attr, LOG_POOL);
|
|
|
|
|
2006-06-05 17:37:24 +00:00
|
|
|
switch_queue_create(&LOG_QUEUE, SWITCH_CORE_QUEUE_LEN, LOG_POOL);
|
2009-02-26 22:30:00 +00:00
|
|
|
#ifdef SWITCH_LOG_RECYCLE
|
2007-09-30 20:05:18 +00:00
|
|
|
switch_queue_create(&LOG_RECYCLE_QUEUE, SWITCH_CORE_QUEUE_LEN, LOG_POOL);
|
2009-02-26 22:30:00 +00:00
|
|
|
#endif
|
2006-04-11 21:13:44 +00:00
|
|
|
switch_mutex_init(&BINDLOCK, SWITCH_MUTEX_NESTED, LOG_POOL);
|
2006-04-26 17:18:33 +00:00
|
|
|
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
2006-04-11 21:13:44 +00:00
|
|
|
switch_thread_create(&thread, thd_attr, log_thread, NULL, LOG_POOL);
|
|
|
|
|
|
|
|
while (!THREAD_RUNNING) {
|
2008-11-14 23:31:21 +00:00
|
|
|
switch_cond_next();
|
2006-04-11 21:13:44 +00:00
|
|
|
}
|
2008-07-11 14:35:08 +00:00
|
|
|
|
|
|
|
if (colorize) {
|
|
|
|
#ifdef WIN32
|
2010-02-06 03:38:24 +00:00
|
|
|
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
|
|
if (switch_core_get_console() == stdout && hStdout != INVALID_HANDLE_VALUE && GetConsoleScreenBufferInfo(hStdout, &csbiInfo)) {
|
|
|
|
wOldColorAttrs = csbiInfo.wAttributes;
|
|
|
|
COLORIZE = SWITCH_TRUE;
|
|
|
|
}
|
2008-07-11 14:35:08 +00:00
|
|
|
#else
|
2010-02-06 03:38:24 +00:00
|
|
|
COLORIZE = SWITCH_TRUE;
|
2008-07-11 14:35:08 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-04-11 21:13:44 +00:00
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-10-04 17:25:06 +00:00
|
|
|
SWITCH_DECLARE(void) switch_core_memory_reclaim_logger(void)
|
2006-04-11 21:13:44 +00:00
|
|
|
{
|
2009-02-26 22:30:00 +00:00
|
|
|
#ifdef SWITCH_LOG_RECYCLE
|
2007-09-30 20:05:18 +00:00
|
|
|
void *pop;
|
2007-10-04 20:22:37 +00:00
|
|
|
int size = switch_queue_size(LOG_RECYCLE_QUEUE);
|
2012-04-10 21:17:16 +00:00
|
|
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CONSOLE, "Returning %d recycled log node(s) %d bytes\n", size,
|
2008-05-27 04:30:03 +00:00
|
|
|
(int) sizeof(switch_log_node_t) * size);
|
2007-09-30 20:05:18 +00:00
|
|
|
while (switch_queue_trypop(LOG_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
|
2009-08-18 18:24:31 +00:00
|
|
|
switch_log_node_free(&pop);
|
2007-09-30 20:05:18 +00:00
|
|
|
}
|
2009-02-26 22:30:00 +00:00
|
|
|
#else
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
2007-10-04 17:25:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SWITCH_DECLARE(switch_status_t) switch_log_shutdown(void)
|
|
|
|
{
|
2009-02-20 01:10:59 +00:00
|
|
|
switch_status_t st;
|
2007-09-30 20:05:18 +00:00
|
|
|
|
2012-06-28 15:10:13 +00:00
|
|
|
|
2007-10-04 17:25:06 +00:00
|
|
|
switch_queue_push(LOG_QUEUE, NULL);
|
|
|
|
while (THREAD_RUNNING) {
|
2008-11-14 23:31:21 +00:00
|
|
|
switch_cond_next();
|
2007-10-04 17:25:06 +00:00
|
|
|
}
|
2009-02-20 01:10:59 +00:00
|
|
|
|
|
|
|
switch_thread_join(&st, thread);
|
|
|
|
|
2007-10-04 17:25:06 +00:00
|
|
|
switch_core_memory_reclaim_logger();
|
2008-05-27 04:30:03 +00:00
|
|
|
|
2006-04-11 21:13:44 +00:00
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2009-08-18 18:24:31 +00:00
|
|
|
|
2006-11-27 22:30:48 +00:00
|
|
|
/* For Emacs:
|
|
|
|
* Local Variables:
|
|
|
|
* mode:c
|
2008-02-03 22:14:57 +00:00
|
|
|
* indent-tabs-mode:t
|
2006-11-27 22:30:48 +00:00
|
|
|
* tab-width:4
|
|
|
|
* c-basic-offset:4
|
|
|
|
* End:
|
|
|
|
* For VIM:
|
2013-06-25 16:50:17 +00:00
|
|
|
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
|
2006-11-27 22:30:48 +00:00
|
|
|
*/
|