Ejemplo n.º 1
0
static void common_output(int level,char* buf)
{
    if (level < -1)
        level = -1;
    if (level > DebugMax)
        level = DebugMax;
    int n = ::strlen(buf);
    if (n && (buf[n-1] == '\n'))
        n--;
    // serialize the output strings
    out_mux.lock();
    // TODO: detect reentrant calls from foreign threads and main thread
    s_thr = Thread::current();
    if (CapturedEvent::capturing()) {
        buf[n] = '\0';
        bool save = s_debugging;
        s_debugging = false;
        CapturedEvent::append(level,buf);
        s_debugging = save;
    }
    buf[n] = '\n';
    buf[n+1] = '\0';
    if (s_output)
        s_output(buf,level);
    if (s_intout)
        s_intout(buf,level);
    buf[n] = '\0';
    s_thr = 0;
    out_mux.unlock();
}
Ejemplo n.º 2
0
static void common_output(int level,char* buf)
{
    if (level < -1)
	level = -1;
    if (level > DebugMax)
	level = DebugMax;
    int n = ::strlen(buf);
    if (n && (buf[n-1] == '\n'))
	    n--;
    buf[n] = '\n';
    buf[n+1] = '\0';
    // serialize the output strings
    out_mux.lock();
    // TODO: detect reentrant calls from foreign threads and main thread
    s_thr = Thread::current();
    if (s_output)
	s_output(buf,level);
    if (s_intout)
	s_intout(buf,level);
    s_thr = 0;
    out_mux.unlock();
}