From bae302629e7fbba80eb48059a63c83242f2e957c Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 21 Jun 2015 21:54:27 +0200 Subject: [PATCH] [DEV] correct the android log --- etk/log.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/etk/log.cpp b/etk/log.cpp index 15235b9..12ae8f9 100644 --- a/etk/log.cpp +++ b/etk/log.cpp @@ -419,7 +419,26 @@ void etk::log::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* tmpPointer = tmpPointer+strlen(tmpPointer); } if (_funcName != nullptr) { - snprintf(tmpPointer, 1024, "%s", _funcName); + // cleen for android : + char* startPos = strchr(_funcName, ' '); + char* stopPos = strchr(_funcName, '('); + if (startPos != nullptr) { + if (stopPos != nullptr) { + if(stopPos < startPos) { + snprintf(tmpPointer, std::min(1024, stopPos-_funcName), "%s", _funcName); + } else { + snprintf(tmpPointer, std::min(1024, stopPos-startPos), "%s", startPos+1); + } + } else { + snprintf(tmpPointer, 1024, "%s", startPos); + } + } else { + if (stopPos != nullptr) { + snprintf(tmpPointer, std::min(1024, stopPos-_funcName), "%s", _funcName); + } else { + snprintf(tmpPointer, 1024, "%s", _funcName); + } + } tmpPointer = tmpPointer+strlen(tmpPointer); } size_t lenFunc = strlen(tmpName);