Skip to content

Commit

Permalink
log: 不打印 strerror
Browse files Browse the repository at this point in the history
* 在非 Unix-like 平台上无意义

Signed-off-by: xychen <[email protected]>
  • Loading branch information
xychen committed Mar 13, 2024
1 parent b2cd50c commit d27d4ba
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions liblog/include/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ const char *errid(int errnum);
} \
} while (0);

#define LOGE_RET(ret, format, ...) \
if (ret < 0) { \
LOGE(format ": %s (%s)", ##__VA_ARGS__, errid(-ret), strerror(-ret)); \
} else { \
LOGE(format ": %02X", ##__VA_ARGS__, (uint8_t)(ret & 0xFF)); \
#define LOGE_RET(ret, format, ...) \
if (ret < 0) { \
LOGE(format ": %s", ##__VA_ARGS__, errid(-ret)); \
} else { \
LOGE(format ": %02X", ##__VA_ARGS__, (uint8_t)(ret & 0xFF)); \
}

#define LOGI_RET(ret, format, ...) \
if (ret < 0) { \
LOGI(format ": %s (%s)", ##__VA_ARGS__, errid(-ret), strerror(-ret)); \
} else { \
LOGI(format ": %02X", ##__VA_ARGS__, (uint8_t)(ret & 0xFF)); \
#define LOGI_RET(ret, format, ...) \
if (ret < 0) { \
LOGI(format ": %s", ##__VA_ARGS__, errid(-ret)); \
} else { \
LOGI(format ": %02X", ##__VA_ARGS__, (uint8_t)(ret & 0xFF)); \
}

#define LOGD_RET(ret, format, ...) \
if (ret < 0) { \
LOGD(format ": %s (%s)", ##__VA_ARGS__, errid(-ret), strerror(-ret)); \
} else { \
LOGD(format ": %02X", ##__VA_ARGS__, (uint8_t)(ret & 0xFF)); \
#define LOGD_RET(ret, format, ...) \
if (ret < 0) { \
LOGD(format ": %s", ##__VA_ARGS__, errid(-ret)); \
} else { \
LOGD(format ": %02X", ##__VA_ARGS__, (uint8_t)(ret & 0xFF)); \
}

#define LOG_TRACE(format, ...) \
Expand Down

0 comments on commit d27d4ba

Please sign in to comment.