mirror of
https://github.com/openharmony/utils_native.git
synced 2026-07-21 01:25:42 -04:00
deal with the problem of log
1.The level of log in string_ex is too high. We decide to change it to DEBUG. 2.The log for DEBUG should not be print out in a common mode. So we give it a macro to divide it from common mode. Signed-off-by: liujialiang <liujialiang10@huawei.com> Change-Id: Ib6d7c263a7601b3c1867dd427b7f0b7f8e2f7f9a
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(...)
|
||||
|
||||
Reference in New Issue
Block a user