Changeset 1943


Ignore:
Timestamp:
Sep 23, 2012, 5:35:20 PM (5 years ago)
Author:
sam
Message:

android: print thread ID with all messages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/log.cpp

    r1695 r1943  
    2222#if defined __ANDROID__
    2323#   include <android/log.h>
     24#   include <unistd.h> /* for gettid() */
    2425#else
    2526#   include <cstdarg>
     
    7475{
    7576#if defined __ANDROID__
    76     int prio[] =
     77    int const prio[] =
    7778    {
    7879        ANDROID_LOG_DEBUG,
     
    8283    };
    8384
    84     //__android_log_print(prio[type], "LOL", "thread %ld", pthread_self());
    85     __android_log_vprint(prio[type], "LOL", fmt, ap);
     85    char buf[4096];
     86    vsnprintf(buf, 4095, fmt, ap);
     87    buf[4095] = '\0';
     88
     89    __android_log_print(prio[type], "LOL", "[%d] %s", (int)gettid(), buf);
    8690
    8791#else
Note: See TracChangeset for help on using the changeset viewer.