log: add new parm to spdk_trace_dump()

Allows called to specify something other than stderr such as
stdout. Existing callers updated to use stderr.

Change-Id: I48a703e1474a45952878121a83c19fef1c43d630
Signed-off-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/377420
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Paul Luse 2017-09-06 13:17:54 -07:00 committed by Jim Harris
parent 8268da8b38
commit 9b99f2c0f3
5 changed files with 9 additions and 5 deletions

View File

@ -73,6 +73,10 @@ The ability to set a thread name, previously only used by the reactor code, is
now part of the `spdk_thread_allocate()` API. Users may specify a thread name
which will show up in tools like `gdb`.
### Log
The API spdk_trace_dump() now takes a new parameter to allow the caller to
specify stdout or stderr for example.
## v17.07: Build system improvements, userspace vhost-blk target, and GPT bdev

View File

@ -94,7 +94,7 @@ enum spdk_log_level spdk_log_get_print_level(void);
void spdk_log(enum spdk_log_level level, const char *file, const int line, const char *func,
const char *format, ...) __attribute__((__format__(__printf__, 5, 6)));
void spdk_trace_dump(const char *label, const uint8_t *buf, size_t len);
void spdk_trace_dump(FILE *fp, const char *label, const uint8_t *buf, size_t len);
bool spdk_log_get_trace_flag(const char *flag);
int spdk_log_set_trace_flag(const char *flag);

View File

@ -85,7 +85,7 @@ __attribute__((constructor)) static void register_trace_flag_##flag(void) \
do { \
extern struct spdk_trace_flag FLAG; \
if ((FLAG.enabled) && (LEN)) { \
spdk_trace_dump((LABEL), (BUF), (LEN)); \
spdk_trace_dump(stderr, (LABEL), (BUF), (LEN)); \
} \
} while (0)

View File

@ -166,9 +166,9 @@ fdump(FILE *fp, const char *label, const uint8_t *buf, size_t len)
}
void
spdk_trace_dump(const char *label, const uint8_t *buf, size_t len)
spdk_trace_dump(FILE *fp, const char *label, const uint8_t *buf, size_t len)
{
fdump(stderr, label, buf, len);
fdump(fp, label, buf, len);
}
static struct spdk_trace_flag *

View File

@ -67,7 +67,7 @@ log_test(void)
SPDK_WARNLOG("log warning unit test\n");
SPDK_DEBUGLOG(SPDK_TRACE_LOG, "log trace test\n");
SPDK_TRACEDUMP(SPDK_TRACE_LOG, "log trace dump test:", "trace dump", 10);
spdk_trace_dump("spdk dump test:", "spdk dump", 9);
spdk_trace_dump(stderr, "spdk dump test:", "spdk dump", 9);
spdk_log_close();
}