示例#1
0
void Debug(const DebugEnabler* local, int level, const char* format, ...)
{
    if (!s_debugging)
        return;
    const char* facility = 0;
    if (!local) {
        if (level > s_debug || level < DebugMin)
            return;
    }
    else {
        if (!local->debugAt(level))
            return;
        facility = local->debugName();
    }
    if (reentered())
        return;
    if (!format)
        format = "";
    char buf[64];
    if (facility)
        ::snprintf(buf,sizeof(buf),"<%s:%s> ",facility,dbg_level(level));
    else
        ::sprintf(buf,"<%s> ",dbg_level(level));
    va_list va;
    va_start(va,format);
    ind_mux.lock();
    dbg_output(level,buf,format,va);
    ind_mux.unlock();
    va_end(va);
    if (s_abort && (level == DebugFail))
        abort();
}
示例#2
0
void Alarm(const DebugEnabler* component, const char* info, int level, const char* format, ...)
{
    if (!format || level < DebugMin || reentered())
        return;
    const char* name = (component && !TelEngine::null(component->debugName()))
                       ? component->debugName() : "unknown";
    char buf[64];
    ::snprintf(buf,sizeof(buf),"<%s:%s> ",name,dbg_level(level));
    va_list va;
    va_start(va,format);
    ind_mux.lock();
    dbg_output(level,buf,format,va,name,info);
    ind_mux.unlock();
    va_end(va);
    if (s_abort && (level == DebugFail))
        abort();
}
示例#3
0
void Alarm(const char* component, int level, const char* format, ...)
{
    if (!format || level < DebugMin || reentered())
        return;
    if (TelEngine::null(component))
        component = "unknown";
    char buf[64];
    ::snprintf(buf,sizeof(buf),"<%s:%s> ",component,dbg_level(level));
    va_list va;
    va_start(va,format);
    ind_mux.lock();
    dbg_output(level,buf,format,va,component);
    ind_mux.unlock();
    va_end(va);
    if (s_abort && (level == DebugFail))
        abort();
}
示例#4
0
void Debug(const char* facility, int level, const char* format, ...)
{
    if (!s_debugging)
        return;
    if (level > s_debug || level < DebugMin)
        return;
    if (reentered())
        return;
    if (!format)
        format = "";
    char buf[64];
    ::snprintf(buf,sizeof(buf),"<%s:%s> ",facility,dbg_level(level));
    va_list va;
    va_start(va,format);
    ind_mux.lock();
    dbg_output(level,buf,format,va);
    ind_mux.unlock();
    va_end(va);
    if (s_abort && (level == DebugFail))
        abort();
}
示例#5
0
void Debug(int level, const char* format, ...)
{
    if (!s_debugging)
	return;
    if (level > s_debug)
	return;
    if (reentered())
	return;
    if (!format)
	format = "";
    char buf[32];
    ::sprintf(buf,"<%s> ",dbg_level(level));
    va_list va;
    va_start(va,format);
    ind_mux.lock();
    dbg_output(level,buf,format,va);
    ind_mux.unlock();
    va_end(va);
    if (s_abort && (level == DebugFail))
	abort();
}
示例#6
0
const char* debugLevelName(int level)
{
    return (level < DebugMin) ? "" : dbg_level(level);
}