Add WARNF_perror() macro

This commit is contained in:
Andrew Bettison 2012-08-27 12:59:40 +09:30 committed by Andrew Bettison
parent 19dd10b1cc
commit 60d84817bf

5
log.h
View File

@ -105,11 +105,12 @@ void set_log_implementation(void (*log_function)(int level, struct strbuf *buf))
#define WHYFNULL(F,...) (LOGF(LOG_LEVEL_ERROR, F, ##__VA_ARGS__), NULL)
#define WHYNULL(X) (WHYFNULL("%s", (X)))
#define WHYF_perror(F,...) WHYF(F ": %s [errno=%d]", ##__VA_ARGS__, strerror(errno), errno)
#define WHY_perror(X) WHYF("%s: %s [errno=%d]", (X), strerror(errno), errno)
#define WHY_perror(X) WHYF_perror("%s", (X))
#define WARNF(F,...) LOGF(LOG_LEVEL_WARN, F, ##__VA_ARGS__)
#define WARN(X) WARNF("%s", (X))
#define WARN_perror(X) WARNF("%s: %s [errno=%d]", (X), strerror(errno), errno)
#define WARNF_perror(F,...) WARNF(F ": %s [errno=%d]", ##__VA_ARGS__, strerror(errno), errno)
#define WARN_perror(X) WARNF_perror("%s", (X))
#define WHY_argv(X,ARGC,ARGV) logArgv(LOG_LEVEL_ERROR, __HERE__, (X), (ARGC), (ARGV))
#define INFOF(F,...) LOGF(LOG_LEVEL_INFO, F, ##__VA_ARGS__)