file/func specific logging

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1128 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West
2006-04-12 17:51:47 +00:00
parent 1fb8ba75d9
commit a9a23aed22
4 changed files with 103 additions and 2 deletions

View File

@@ -41,7 +41,8 @@ static const char *LEVELS[] = {
"NOTICE" ,
"INFO" ,
"DEBUG" ,
"CONSOLE"
"CONSOLE",
NULL
};
struct switch_log_binding {
@@ -59,6 +60,28 @@ static switch_queue_t *LOG_QUEUE = NULL;
static int8_t THREAD_RUNNING = 0;
static uint8_t MAX_LEVEL = 0;
SWITCH_DECLARE(const char *) switch_log_level2str(switch_log_level level)
{
return LEVELS[level];
}
SWITCH_DECLARE(switch_log_level) switch_log_str2level(const char *str)
{
int x = 0;
switch_log_level level = SWITCH_LOG_DEBUG;
for(x = 0;;x++) {
if (!LEVELS[x]) {
break;
}
if (!strcasecmp(LEVELS[x], str)) {
level = (switch_log_level) x;
break;
}
}
return level;
}
SWITCH_DECLARE(switch_status) switch_log_bind_logger(switch_log_function function, switch_log_level level)
{
switch_log_binding *binding = NULL, *ptr = NULL;