Skip to content

Commit

Permalink
[libknet] logging: add handle information in log structure
Browse files Browse the repository at this point in the history
Use case: an app is using the same fd to gather logs from
multiple knet_h, the app might still require to know which
knet_h has generated the log for better logging purposes

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Dec 20, 2018
1 parent c9b7e5e commit 2e5617e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions libknet/libknet.h
Expand Up @@ -1921,6 +1921,7 @@ struct knet_log_msg {
char msg[KNET_MAX_LOG_MSG_SIZE];
uint8_t subsystem; /* KNET_SUB_* */
uint8_t msglevel; /* KNET_LOG_* */
knet_handle_t knet_h; /* pointer to the handle generating the log */
};

/**
Expand Down
1 change: 1 addition & 0 deletions libknet/logging.c
Expand Up @@ -221,6 +221,7 @@ void log_msg(knet_handle_t knet_h, uint8_t subsystem, uint8_t msglevel,
memset(&msg, 0, sizeof(struct knet_log_msg));
msg.subsystem = subsystem;
msg.msglevel = msglevel;
msg.knet_h = knet_h;

va_start(ap, fmt);
#ifdef __clang__
Expand Down

0 comments on commit 2e5617e

Please sign in to comment.