diff --git a/base/src/string_ex.cpp b/base/src/string_ex.cpp index 65ce7d248c9c31e84665db25c3e08fe4f2df9a5e..dc12736ba43962bd46e41664a84862666b6a9e4e 100644 --- a/base/src/string_ex.cpp +++ b/base/src/string_ex.cpp @@ -111,7 +111,7 @@ bool StrToInt(const string& str, int& value) auto result = strtol(addr, &end, 10); /* 10 means decimal */ if ((end == addr) || (end[0] != '\0') || (errno == ERANGE) || (result > INT_MAX) || (result < INT_MIN)) { - UTILS_LOGE("call StrToInt func false, input str is: %{public}s!", str.c_str()); + UTILS_LOGD("call StrToInt func false, input str is: %{public}s!", str.c_str()); return false; } @@ -122,13 +122,13 @@ bool StrToInt(const string& str, int& value) bool IsNumericStr(const string& str) { if (str.empty()) { - UTILS_LOGE("call IsNumericStr func, input str is empty!"); + UTILS_LOGD("call IsNumericStr func, input str is empty!"); return false; } for (const auto& c : str) { if (!isdigit(c)) { - UTILS_LOGE("call IsNumericStr func false, input str is: %{public}s!", str.c_str()); + UTILS_LOGD("call IsNumericStr func false, input str is: %{public}s!", str.c_str()); return false; } } @@ -139,13 +139,13 @@ bool IsNumericStr(const string& str) bool IsAlphaStr(const string& str) { if (str.empty()) { - UTILS_LOGE("call IsAlphaStr func, input str is empty!"); + UTILS_LOGD("call IsAlphaStr func, input str is empty!"); return false; } for (const auto& c : str) { if (!isalpha(c)) { - UTILS_LOGE("call IsAlphaStr func false, input str is: %{public}s!", str.c_str()); + UTILS_LOGD("call IsAlphaStr func false, input str is: %{public}s!", str.c_str()); return false; } } @@ -156,13 +156,13 @@ bool IsAlphaStr(const string& str) bool IsUpperStr(const string& str) { if (str.empty()) { - UTILS_LOGE("call IsUpperStr func, input str is empty!"); + UTILS_LOGD("call IsUpperStr func, input str is empty!"); return false; } for (const auto& c : str) { if (!isupper(c)) { - UTILS_LOGE("call IsUpperStr func false, input str is: %{public}s!", str.c_str()); + UTILS_LOGD("call IsUpperStr func false, input str is: %{public}s!", str.c_str()); return false; } } @@ -173,13 +173,13 @@ bool IsUpperStr(const string& str) bool IsLowerStr(const string& str) { if (str.empty()) { - UTILS_LOGE("call IsLowerStr func, input str is empty!"); + UTILS_LOGD("call IsLowerStr func, input str is empty!"); return false; } for (const auto& c : str) { if (!islower(c)) { - UTILS_LOGE("call IsLowerStr func false, input str is: %{public}s!", str.c_str()); + UTILS_LOGD("call IsLowerStr func false, input str is: %{public}s!", str.c_str()); return false; } } diff --git a/base/src/utils_log.h b/base/src/utils_log.h index 9fda24fec1f9b0cb008167a862639f2f57af86fa..1b3efac5c6ad3826d170fdfc2613c9ea800d091c 100644 --- a/base/src/utils_log.h +++ b/base/src/utils_log.h @@ -24,8 +24,12 @@ constexpr const char *UTILS_LOG_TAG = "utils_base"; #define UTILS_LOGE(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_ERROR, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) #define UTILS_LOGW(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_WARN, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) #define UTILS_LOGI(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_INFO, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) +#ifdef DEBUG_UTILS #define UTILS_LOGD(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_DEBUG, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) #else +#define UTILS_LOGD(...) +#endif +#else #define UTILS_LOGF(...) #define UTILS_LOGE(...) #define UTILS_LOGW(...)