Add a logging subsystem and change all DPRINTF to ISCSI_LOG
Add a mechanism where we can set a logging subsystem that libiscsi can use. Create an example 'log to stderr' that utilities can use for convenience.
This commit is contained in:
@@ -177,7 +177,7 @@ int iscsi_reconnect(struct iscsi_context *old_iscsi)
|
||||
{
|
||||
struct iscsi_context *iscsi = old_iscsi;
|
||||
|
||||
DPRINTF(iscsi,2,"reconnect initiated");
|
||||
ISCSI_LOG(iscsi, 2, "reconnect initiated");
|
||||
|
||||
/* This is mainly for tests, where we do not want to automatically
|
||||
reconnect but rather want the commands to fail with an error
|
||||
@@ -235,10 +235,10 @@ try_again:
|
||||
|
||||
iscsi->lun = old_iscsi->lun;
|
||||
|
||||
strncpy(iscsi->portal,old_iscsi->portal,MAX_STRING_SIZE);
|
||||
|
||||
iscsi->debug = old_iscsi->debug;
|
||||
strncpy(iscsi->portal,old_iscsi->portal, MAX_STRING_SIZE);
|
||||
|
||||
iscsi->log_level = old_iscsi->log_level;
|
||||
iscsi->log_fn = old_iscsi->log_fn;
|
||||
iscsi->tcp_user_timeout = old_iscsi->tcp_user_timeout;
|
||||
iscsi->tcp_keepidle = old_iscsi->tcp_keepidle;
|
||||
iscsi->tcp_keepcnt = old_iscsi->tcp_keepcnt;
|
||||
@@ -254,7 +254,7 @@ try_again:
|
||||
if (backoff > 30) {
|
||||
backoff=30;
|
||||
}
|
||||
DPRINTF(iscsi,1,"reconnect try %d failed, waiting %d seconds",retry,backoff);
|
||||
ISCSI_LOG(iscsi, 1, "reconnect try %d failed, waiting %d seconds",retry,backoff);
|
||||
iscsi_destroy_context(iscsi);
|
||||
sleep(backoff);
|
||||
retry++;
|
||||
|
||||
Reference in New Issue
Block a user