log: add SPDK_INFOLOG() macro
SPDK_INFOLOG() is comparable to SPDK_DEBUGLOG() in that it takes a per-component trace flag, but it is available even in non-debug builds. This patch also makes SPDK_LOG_REGISTER_TRACE_FLAG() active for all builds, not just debug builds. Change-Id: I9727b1a20bd1efa0f97b743d4f529c2b1f6be112 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/375835 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
932a186b4c
commit
b52e8b2588
@ -53,7 +53,6 @@ void spdk_log_register_trace_flag(const char *name, struct spdk_trace_flag *flag
|
||||
struct spdk_trace_flag *spdk_log_get_first_trace_flag(void);
|
||||
struct spdk_trace_flag *spdk_log_get_next_trace_flag(struct spdk_trace_flag *flag);
|
||||
|
||||
#ifdef DEBUG
|
||||
#define SPDK_LOG_REGISTER_TRACE_FLAG(str, flag) \
|
||||
struct spdk_trace_flag flag = { \
|
||||
.enabled = false, \
|
||||
@ -64,6 +63,16 @@ __attribute__((constructor)) static void register_trace_flag_##flag(void) \
|
||||
spdk_log_register_trace_flag(str, &flag); \
|
||||
}
|
||||
|
||||
#define SPDK_INFOLOG(FLAG, ...) \
|
||||
do { \
|
||||
extern struct spdk_trace_flag FLAG; \
|
||||
if (FLAG.enabled) { \
|
||||
spdk_log(SPDK_LOG_INFO, __FILE__, __LINE__, __func__, __VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#define SPDK_DEBUGLOG(FLAG, ...) \
|
||||
do { \
|
||||
extern struct spdk_trace_flag FLAG; \
|
||||
@ -81,7 +90,6 @@ __attribute__((constructor)) static void register_trace_flag_##flag(void) \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
#define SPDK_LOG_REGISTER_TRACE_FLAG(str, flag)
|
||||
#define SPDK_DEBUGLOG(...) do { } while (0)
|
||||
#define SPDK_TRACEDUMP(...) do { } while (0)
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user