AndroidLinux大于1024Bytes打印

    技术2023-12-22  62

    1.Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) #LOCAL_MULTILIB := 32 LOCAL_SRC_FILES := print-log.cpp LOCAL_MODULE := print-log LOCAL_MODULE_TAGS := optinal LOCAL_SHARED_LIBRARIES := liblog libutils include $(BUILD_EXECUTABLE) 2.print-log.cpp #include <log/log.h> #include <iostream> #include <string> #undef NDEBUG #undef LOG_TAG #define LOG_TAG "print_log" #define LOG_MAX 1024 static void print_str(std::string buffer, char *func, int line){ int len = buffer.length(); int start = 0; int end = LOG_MAX; ALOGE("xxx---starting------->%s(), line = %d, len = %d",func,line,len); for(int i = 0; i < 100; i++){ if(len > end){ //linux log //cout << buffer.substr(start, LOG_MAX) << endl; //android log ALOGE("%s(): data[%d] = %s",__FUNCTION__,i,buffer.substr(start, LOG_MAX).c_str());
    Processed: 0.015, SQL: 9