FreeSWITCH API Documentation  1.7.0
switch_log.c
Go to the documentation of this file.
1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Anthony Minessale II <anthm@freeswitch.org>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Anthony Minessale II <anthm@freeswitch.org>
27  *
28  *
29  * switch_log.c -- Logging
30  *
31  */
32 
33 #include <switch.h>
35 
36 static const char *LEVELS[] = {
37  "CONSOLE",
38  "ALERT",
39  "CRIT",
40  "ERR",
41  "WARNING",
42  "NOTICE",
43  "INFO",
44  "DEBUG",
45  NULL
46 };
47 
53 };
54 
56 
59 static switch_mutex_t *BINDLOCK = NULL;
60 static switch_queue_t *LOG_QUEUE = NULL;
61 #ifdef SWITCH_LOG_RECYCLE
62 static switch_queue_t *LOG_RECYCLE_QUEUE = NULL;
63 #endif
64 static int8_t THREAD_RUNNING = 0;
65 static uint8_t MAX_LEVEL = 0;
66 static int mods_loaded = 0;
67 static int console_mods_loaded = 0;
69 
70 #ifdef WIN32
71 static HANDLE hStdout;
72 static WORD wOldColorAttrs;
73 static CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
74 
75 static WORD
76 #else
77 static const char *
78 #endif
79 
80 
81 
82 
83  COLORS[] =
86 
87 
89 {
90  switch_log_node_t *node = NULL;
91 #ifdef SWITCH_LOG_RECYCLE
92  void *pop = NULL;
93 
94  if (switch_queue_trypop(LOG_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
95  node = (switch_log_node_t *) pop;
96  } else {
97 #endif
98  node = malloc(sizeof(*node));
99  switch_assert(node);
100 #ifdef SWITCH_LOG_RECYCLE
101  }
102 #endif
103  return node;
104 }
105 
107 {
109 
110  *newnode = *node;
111 
112  if (!zstr(node->data)) {
113  newnode->data = strdup(node->data);
114  switch_assert(node->data);
115  }
116 
117  if (!zstr(node->userdata)) {
118  newnode->userdata = strdup(node->userdata);
119  switch_assert(node->userdata);
120  }
121 
122  return newnode;
123 }
124 
126 {
127  switch_log_node_t *node;
128 
129  if (!pnode) {
130  return;
131  }
132 
133  node = *pnode;
134 
135  if (node) {
136  switch_safe_free(node->userdata);
137  switch_safe_free(node->data);
138 #ifdef SWITCH_LOG_RECYCLE
139  if (switch_queue_trypush(LOG_RECYCLE_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
140  free(node);
141  }
142 #else
143  free(node);
144 #endif
145  }
146  *pnode = NULL;
147 }
148 
150 {
151  if (level > SWITCH_LOG_DEBUG) {
152  level = SWITCH_LOG_DEBUG;
153  }
154  return LEVELS[level];
155 }
156 
157 SWITCH_DECLARE(uint32_t) switch_log_str2mask(const char *str)
158 {
159  int argc = 0, x = 0;
160  char *argv[10] = { 0 };
161  uint32_t mask = 0;
162  char *p = strdup(str);
164 
165  switch_assert(p);
166 
167  if ((argc = switch_separate_string(p, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
168  for (x = 0; x < argc && argv[x]; x++) {
169  if (!strcasecmp(argv[x], "all")) {
170  mask = 0xFF;
171  break;
172  } else {
173  level = switch_log_str2level(argv[x]);
174  if (level != SWITCH_LOG_INVALID) {
175  mask |= (1 << level);
176  }
177  }
178  }
179  }
180 
181  free(p);
182 
183  return mask;
184 }
185 
187 {
188  int x = 0;
190 
191  if (switch_is_number(str)) {
192  x = atoi(str);
193 
194  if (x > SWITCH_LOG_INVALID) {
195  return SWITCH_LOG_INVALID - 1;
196  } else if (x < 0) {
197  return 0;
198  } else {
199  return x;
200  }
201  }
202 
203 
204  for (x = 0;; x++) {
205  if (!LEVELS[x]) {
206  break;
207  }
208 
209  if (!strcasecmp(LEVELS[x], str)) {
210  level = (switch_log_level_t) x;
211  break;
212  }
213  }
214 
215  return level;
216 }
217 
219 {
220  switch_log_binding_t *ptr = NULL, *last = NULL;
222 
224  for (ptr = BINDINGS; ptr; ptr = ptr->next) {
225  if (ptr->function == function) {
226  if (last) {
227  last->next = ptr->next;
228  } else {
229  BINDINGS = ptr->next;
230  }
231  status = SWITCH_STATUS_SUCCESS;
232  mods_loaded--;
233  if (ptr->is_console) {
235  }
236  break;
237  }
238  last = ptr;
239  }
241 
242  return status;
243 }
244 
246 {
247  switch_log_binding_t *binding = NULL, *ptr = NULL;
248  switch_assert(function != NULL);
249 
250  if (!(binding = switch_core_alloc(LOG_POOL, sizeof(*binding)))) {
251  return SWITCH_STATUS_MEMERR;
252  }
253 
254  if ((uint8_t) level > MAX_LEVEL) {
255  MAX_LEVEL = level;
256  }
257 
258  binding->function = function;
259  binding->level = level;
260  binding->is_console = is_console;
261 
263  for (ptr = BINDINGS; ptr && ptr->next; ptr = ptr->next);
264 
265  if (ptr) {
266  ptr->next = binding;
267  } else {
268  BINDINGS = binding;
269  }
270  if (is_console) {
272  }
273  mods_loaded++;
275 
276  return SWITCH_STATUS_SUCCESS;
277 }
278 
280 
281 static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *t, void *obj)
282 {
283 
284  if (!obj) {
285  obj = NULL;
286  }
287  THREAD_RUNNING = 1;
288 
289  while (THREAD_RUNNING == 1) {
290  void *pop = NULL;
291  switch_log_node_t *node = NULL;
292  switch_log_binding_t *binding;
293 
295  break;
296  }
297 
298  if (!pop) {
299  THREAD_RUNNING = -1;
300  break;
301  }
302 
303  node = (switch_log_node_t *) pop;
305  for (binding = BINDINGS; binding; binding = binding->next) {
306  if (binding->level >= node->level) {
307  binding->function(node, node->level);
308  }
309  }
311 
312  switch_log_node_free(&node);
313 
314  }
315 
316  THREAD_RUNNING = 0;
318  return NULL;
319 }
320 
321 SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
322  const char *userdata, switch_log_level_t level, const char *fmt, ...)
323 {
324  va_list ap;
325 
326  va_start(ap, fmt);
327  switch_log_vprintf(channel, file, func, line, userdata, level, fmt, ap);
328  va_end(ap);
329 }
330 
331 #define do_mods (LOG_QUEUE && THREAD_RUNNING)
332 SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const char *file, const char *func, int line,
333  const char *userdata, switch_log_level_t level, const char *fmt, va_list ap)
334 {
335  char *data = NULL;
336  char *new_fmt = NULL;
337  int ret = 0;
338  FILE *handle;
339  const char *filep = (file ? switch_cut_path(file) : "");
340  const char *funcp = (func ? func : "");
341  char *content = NULL;
343  uint32_t len;
344 #ifdef SWITCH_FUNC_IN_LOG
345  const char *extra_fmt = "%s [%s] %s:%d %s()%c%s";
346 #else
347  const char *extra_fmt = "%s [%s] %s:%d%c%s";
348 #endif
350  switch_log_level_t special_level = SWITCH_LOG_UNINIT;
351 
352  if (channel == SWITCH_CHANNEL_ID_SESSION && userdata) {
353  switch_core_session_t *session = (switch_core_session_t *) userdata;
354  special_level = session->loglevel;
355  if (limit_level < session->loglevel) {
356  limit_level = session->loglevel;
357  }
358  }
359 
360  if (level > 100) {
361  if ((uint32_t) (level - 100) > runtime.debug_level) {
362  return;
363  }
364 
365  level = 1;
366  }
367 
368  if (level > limit_level) {
369  return;
370  }
371 
373 
374  handle = switch_core_data_channel(channel);
375 
376  if (channel != SWITCH_CHANNEL_ID_LOG_CLEAN) {
377  char date[80] = "";
378  //switch_size_t retsize;
380 
381  switch_time_exp_lt(&tm, now);
382  switch_snprintf(date, sizeof(date), "%0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.6d",
383  tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec);
384 
385  //switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
386 
387 #ifdef SWITCH_FUNC_IN_LOG
388  len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(funcp) + strlen(fmt));
389 #else
390  len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(fmt));
391 #endif
392  new_fmt = malloc(len + 1);
393  switch_assert(new_fmt);
394 #ifdef SWITCH_FUNC_IN_LOG
395  switch_snprintf(new_fmt, len, extra_fmt, date, switch_log_level2str(level), filep, line, funcp, 128, fmt);
396 #else
397  switch_snprintf(new_fmt, len, extra_fmt, date, switch_log_level2str(level), filep, line, 128, fmt);
398 #endif
399 
400  fmt = new_fmt;
401  }
402 
403  ret = switch_vasprintf(&data, fmt, ap);
404 
405  if (ret == -1) {
406  fprintf(stderr, "Memory Error\n");
407  goto end;
408  }
409 
410  if (channel == SWITCH_CHANNEL_ID_LOG_CLEAN) {
411  content = data;
412  } else {
413  if ((content = strchr(data, 128))) {
414  *content = ' ';
415  }
416  }
417 
418  if (channel == SWITCH_CHANNEL_ID_EVENT) {
419  switch_event_t *event;
421  switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-Data", data);
422  switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-File", filep);
423  switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-Function", funcp);
424  switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Line", "%d", line);
425  switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Level", "%d", (int) level);
426  if (!zstr(userdata)) {
427  switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "User-Data", userdata);
428  }
429  switch_event_fire(&event);
430  data = NULL;
431  }
432 
433  goto end;
434  }
435 
436  if (console_mods_loaded == 0 || !do_mods) {
437  if (handle) {
438  int aok = 1;
439 #ifndef WIN32
440 
441  fd_set can_write;
442  int fd;
443  struct timeval to;
444 
445  fd = fileno(handle);
446  memset(&to, 0, sizeof(to));
447  FD_ZERO(&can_write);
448  FD_SET(fd, &can_write);
449  to.tv_sec = 0;
450  to.tv_usec = 100000;
451  if (select(fd + 1, NULL, &can_write, NULL, &to) > 0) {
452  aok = FD_ISSET(fd, &can_write);
453  } else {
454  aok = 0;
455  }
456 #endif
457  if (aok) {
458  if (COLORIZE) {
459 
460 #ifdef WIN32
461  SetConsoleTextAttribute(hStdout, COLORS[level]);
462  WriteFile(hStdout, data, (DWORD) strlen(data), NULL, NULL);
463  SetConsoleTextAttribute(hStdout, wOldColorAttrs);
464 #else
465  fprintf(handle, "%s%s%s", COLORS[level], data, SWITCH_SEQ_DEFAULT_COLOR);
466 #endif
467  } else {
468  fprintf(handle, "%s", data);
469  }
470  }
471  }
472  }
473 
474  if (do_mods && level <= MAX_LEVEL) {
476 
477  node->data = data;
478  data = NULL;
479  switch_set_string(node->file, filep);
480  switch_set_string(node->func, funcp);
481  node->line = line;
482  node->level = level;
483  node->slevel = special_level;
484  node->content = content;
485  node->timestamp = now;
486  node->channel = channel;
487  if (channel == SWITCH_CHANNEL_ID_SESSION) {
488  switch_core_session_t *session = (switch_core_session_t *) userdata;
489  node->userdata = userdata ? strdup(switch_core_session_get_uuid(session)) : NULL;
490  } else {
491  node->userdata = !zstr(userdata) ? strdup(userdata) : NULL;
492  }
493 
495  switch_log_node_free(&node);
496  }
497  }
498 
499  end:
500 
501  switch_safe_free(data);
502  switch_safe_free(new_fmt);
503 
504 }
505 
507 {
508  switch_threadattr_t *thd_attr;;
509 
510  switch_assert(pool != NULL);
511 
512  LOG_POOL = pool;
513 
515 
517 #ifdef SWITCH_LOG_RECYCLE
518  switch_queue_create(&LOG_RECYCLE_QUEUE, SWITCH_CORE_QUEUE_LEN, LOG_POOL);
519 #endif
522  switch_thread_create(&thread, thd_attr, log_thread, NULL, LOG_POOL);
523 
524  while (!THREAD_RUNNING) {
526  }
527 
528  if (colorize) {
529 #ifdef WIN32
530  hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
531  if (switch_core_get_console() == stdout && hStdout != INVALID_HANDLE_VALUE && GetConsoleScreenBufferInfo(hStdout, &csbiInfo)) {
532  wOldColorAttrs = csbiInfo.wAttributes;
534  }
535 #else
537 #endif
538  }
539 
540 
541  return SWITCH_STATUS_SUCCESS;
542 }
543 
545 {
546 #ifdef SWITCH_LOG_RECYCLE
547  void *pop;
548  int size = switch_queue_size(LOG_RECYCLE_QUEUE);
549  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CONSOLE, "Returning %d recycled log node(s) %d bytes\n", size,
550  (int) sizeof(switch_log_node_t) * size);
551  while (switch_queue_trypop(LOG_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
552  switch_log_node_free(&pop);
553  }
554 #else
555  return;
556 #endif
557 
558 }
559 
561 {
562  switch_status_t st;
563 
564 
566  while (THREAD_RUNNING) {
568  }
569 
571 
573 
574  return SWITCH_STATUS_SUCCESS;
575 }
576 
577 
578 /* For Emacs:
579  * Local Variables:
580  * mode:c
581  * indent-tabs-mode:t
582  * tab-width:4
583  * c-basic-offset:4
584  * End:
585  * For VIM:
586  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
587  */
struct apr_queue_t switch_queue_t
Definition: switch_apr.h:590
switch_time_t switch_micro_time_now(void)
Get the current epoch time in microseconds.
Definition: switch_time.c:310
#define switch_event_fire(event)
Fire an event filling in most of the arguements with obvious values.
Definition: switch_event.h:412
unsigned int switch_queue_size(switch_queue_t *queue)
Definition: switch_apr.c:1114
switch_xml_t switch_status_t switch_event_running(void)
Determine if the event system has been initialized.
Definition: switch_event.c:417
#define SWITCH_CHANNEL_SESSION_LOG(x)
void switch_core_memory_reclaim_logger(void)
Definition: switch_log.c:544
switch_log_level_t level
Definition: switch_log.h:59
static int console_mods_loaded
Definition: switch_log.c:67
#define SWITCH_THREAD_FUNC
switch_text_channel_t
A target to write log/debug info to.
Log Data.
Definition: switch_log.h:49
static uint8_t MAX_LEVEL
Definition: switch_log.c:65
#define SWITCH_CHANNEL_LOG
#define do_mods
Definition: switch_log.c:331
switch_log_function_t function
Definition: switch_log.c:49
switch_time_t timestamp
Definition: switch_log.h:61
static switch_memory_pool_t * LOG_POOL
Definition: switch_log.c:57
switch_bool_t
Definition: switch_types.h:405
#define SWITCH_SEQ_FMAGEN
Definition: switch_types.h:96
switch_log_node_t * switch_log_node_dup(const switch_log_node_t *node)
Definition: switch_log.c:106
switch_status_t switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize)
Definition: switch_apr.c:660
switch_memory_pool_t * pool
switch_status_t switch_event_add_header(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *fmt,...) PRINTF_FUNCTION(4
Add a header to an event.
Representation of an event.
Definition: switch_event.h:80
switch_status_t switch_log_unbind_logger(switch_log_function_t function)
Definition: switch_log.c:218
switch_status_t switch_queue_trypop(switch_queue_t *queue, void **data)
Definition: switch_apr.c:1140
switch_log_level_t slevel
Definition: switch_log.h:67
struct switch_log_binding * next
Definition: switch_log.c:52
switch_bool_t switch_is_number(const char *str)
switch_status_t switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input)
Definition: switch_apr.c:323
void switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line, const char *userdata, switch_log_level_t level, const char *fmt,...)
Definition: switch_log.c:321
switch_status_t switch_queue_pop(switch_queue_t *queue, void **data)
Definition: switch_apr.c:1119
static int mods_loaded
Definition: switch_log.c:66
static switch_thread_t * thread
Definition: switch_log.c:279
int switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format,...)
struct switch_runtime runtime
Definition: switch_core.c:64
static switch_log_binding_t * BINDINGS
Definition: switch_log.c:58
#define zstr(x)
Definition: switch_utils.h:281
switch_text_channel_t channel
Definition: switch_log.h:66
#define SWITCH_SEQ_FYELLOW
Definition: switch_types.h:94
switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
Definition: switch_apr.c:290
switch_status_t switch_thread_join(switch_status_t *retval, switch_thread_t *thd)
Definition: switch_apr.c:1255
#define SWITCH_MUTEX_NESTED
Definition: switch_apr.h:318
uint32_t switch_log_str2mask(const char *str)
Definition: switch_log.c:157
int64_t switch_time_t
Definition: switch_apr.h:188
unsigned int switch_separate_string(_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen)
Separate a string into an array based on a character delimiter.
static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *t, void *obj)
Definition: switch_log.c:281
#define SWITCH_CORE_QUEUE_LEN
Definition: switch_types.h:560
static switch_queue_t * LOG_QUEUE
Definition: switch_log.c:60
switch_status_t switch_mutex_lock(switch_mutex_t *lock)
Definition: switch_apr.c:285
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
Definition: switch_core.h:682
#define SWITCH_THREAD_STACKSIZE
Definition: switch_types.h:551
static int8_t THREAD_RUNNING
Definition: switch_log.c:64
switch_status_t switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
Add a string header to an event.
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
Definition: switch_utils.h:789
#define SWITCH_SEQ_FCYAN
Definition: switch_types.h:97
switch_status_t switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
Definition: switch_apr.c:270
int switch_vasprintf(_Out_opt_ char **buf, _In_z_ _Printf_format_string_ const char *format, _In_ va_list ap)
FILE * switch_core_data_channel(switch_text_channel_t channel)
Retrieve a FILE stream of a given text channel name.
Definition: switch_core.c:263
static const char * LEVELS[]
Definition: switch_log.c:36
#define SWITCH_SEQ_FRED
Definition: switch_types.h:92
static const char * COLORS[]
Definition: switch_log.c:83
void switch_cond_next(void)
Definition: switch_time.c:638
static switch_bool_t COLORIZE
Definition: switch_log.c:68
const char * switch_log_level2str(switch_log_level_t level)
Definition: switch_log.c:149
char * switch_core_session_get_uuid(_In_ switch_core_session_t *session)
Retrieve the unique identifier from a session.
switch_log_level_t switch_log_str2level(const char *str)
Definition: switch_log.c:186
switch_status_t switch_log_shutdown(void)
Shut down the logging engine.
Definition: switch_log.c:560
static switch_mutex_t * BINDLOCK
Definition: switch_log.c:59
switch_status_t switch_log_bind_logger(switch_log_function_t function, switch_log_level_t level, switch_bool_t is_console)
Definition: switch_log.c:245
struct apr_thread_mutex_t switch_mutex_t
Definition: switch_apr.h:314
switch_status_t
Common return values.
static switch_log_node_t * switch_log_node_alloc()
Definition: switch_log.c:88
struct apr_thread_t switch_thread_t
Definition: switch_apr.h:941
switch_log_level_t hard_log_level
Main Library Header.
#define SWITCH_SEQ_DEFAULT_COLOR
Definition: switch_types.h:69
#define switch_event_create(event, id)
Create a new event assuming it will not be custom event and therefore hiding the unused parameters...
Definition: switch_event.h:383
#define SWITCH_DECLARE(type)
void switch_log_vprintf(switch_text_channel_t channel, const char *file, const char *func, int line, const char *userdata, switch_log_level_t level, const char *fmt, va_list ap)
Definition: switch_log.c:332
switch_status_t(* switch_log_function_t)(const switch_log_node_t *node, switch_log_level_t level)
Definition: switch_log.h:70
#define SWITCH_SEQ_FGREEN
Definition: switch_types.h:93
#define switch_set_string(_dst, _src)
Definition: switch_utils.h:665
switch_status_t switch_queue_trypush(switch_queue_t *queue, void *data)
Definition: switch_apr.c:1155
void switch_log_node_free(switch_log_node_t **pnode)
Definition: switch_log.c:125
switch_status_t switch_queue_push(switch_queue_t *queue, void *data)
Definition: switch_apr.c:1129
struct apr_pool_t switch_memory_pool_t
switch_status_t switch_log_init(switch_memory_pool_t *pool, switch_bool_t colorize)
Definition: switch_log.c:506
switch_status_t switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool)
Definition: switch_apr.c:642
switch_status_t switch_thread_create(switch_thread_t **new_thread, switch_threadattr_t *attr, switch_thread_start_t func, void *data, switch_memory_pool_t *cont)
Definition: switch_apr.c:675
uint32_t debug_level
FILE * switch_core_get_console(void)
Get the output console.
Definition: switch_core.c:230
switch_status_t switch_queue_create(switch_queue_t **queue, unsigned int queue_capacity, switch_memory_pool_t *pool)
Definition: switch_apr.c:1109
switch_log_level_t loglevel
switch_log_level_t level
Definition: switch_log.c:50
#define switch_assert(expr)
const char * switch_cut_path(const char *in)
Create a pointer to the file name in a given file path eliminating the directory name.
memset(buf, 0, buflen)
switch_log_level_t
Log Level Enumeration.