Add debugging framework
This patch adds a user configurable debug level. For testing it includes connection info and reporting errors.
This commit is contained in:
@@ -65,6 +65,7 @@ struct iscsi_context {
|
||||
const char *initiator_name;
|
||||
const char *target_name;
|
||||
const char *target_address; /* If a redirect */
|
||||
const char *connected_portal;
|
||||
const char *alias;
|
||||
|
||||
const char *user;
|
||||
@@ -120,6 +121,7 @@ struct iscsi_context {
|
||||
const char *portal;
|
||||
int no_auto_reconnect;
|
||||
int reconnect_deferred;
|
||||
int debug;
|
||||
};
|
||||
|
||||
#define ISCSI_PDU_IMMEDIATE 0x40
|
||||
|
||||
@@ -958,6 +958,14 @@ iscsi_scsi_task_cancel(struct iscsi_context *iscsi,
|
||||
EXTERN void
|
||||
iscsi_scsi_cancel_all_tasks(struct iscsi_context *iscsi);
|
||||
|
||||
#define DPRINTF(iscsi,level,fmt,args...) do { if ((iscsi)->debug >= level) {fprintf(stderr,"libiscsi: ");fprintf(stderr, (fmt), ##args); fprintf(stderr,"\n");} } while (0);
|
||||
|
||||
/*
|
||||
* This function is to set the debugging level (0=disabled).
|
||||
*/
|
||||
EXTERN void
|
||||
iscsi_set_debug(struct iscsi_context *iscsi, int level);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user