UMLog.h 头文件 :
/* DO NOT EDIT THIS FILE - it is machine generated */
#ifndef UM_ANDROID_LOG
#define UM_ANDROID_LOG
#include <jni.h>
#include <android/log.h>
#include <string>
using namespace std;
/**
* Android Log Class
*/
class UMLog
{
public:
UMLog();
~ UMLog();
static void D(char const* tag, char const* msg);
static void V(char const* tag, char const* msg);
static void I(char const* tag, char const* msg);
static void E(char const* tag, char const* msg);
};
#endif
UMLog.cpp 实现文件 :
#include "UMLog.h"
#include <string>
using namespace std;
// debug
void UMLog::D(char const* tag, char const* msg)
{
__android_log_print(ANDROID_LOG_DEBUG, tag, msg);
}
void UMLog::E(char const* tag, char const* msg)
{
__android_log_print(ANDROID_LOG_ERROR, tag, msg);
}
void UMLog::I(char const* tag, char const* msg)
{
__android_log_print(ANDROID_LOG_INFO,tag, msg);
}
void UMLog::V(char const* tag, char const* msg)
{
__android_log_print(ANDROID_LOG_VERBOSE, tag, msg);
}
其中D代表debug, E代表error, i代表Info, v代表verbose。