Logging values of variables in Android native ndk

后端 未结 4 1815
甜味超标
甜味超标 2021-01-30 16:33

I set up logging with C++ in Android NDK.

I can print a message to logcat like this:

__android_log_write(ANDROID_LOG_INFO, \"tag here\", \"mess         


        
4条回答
  •  不知归路
    2021-01-30 17:00

    Take advantage of the variadic log print function you have available. For my own code, I provide a LogInfo() function to make it simple. Of course there are several options available to you here.

    void LogInfo(const char *sTag, const char *fmt, ...)
    {
      va_list ap;
      va_start(ap, fmt);
      __android_log_vprint(ANDROID_LOG_INFO, sTag, fmt, ap);
      va_end(ap);
    }
    

提交回复
热议问题