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:
Ronnie Sahlberg
2012-11-07 06:34:38 -08:00
parent c10ae3ae3e
commit 50e7c682bb
13 changed files with 134 additions and 51 deletions

View File

@@ -265,9 +265,10 @@ int main(int argc, const char *argv[])
exit(10);
}
if (debug > 0) {
iscsi_set_debug(iscsi, debug);
}
if (debug > 0) {
iscsi_set_log_level(iscsi, debug);
iscsi_set_log_fn(iscsi, iscsi_log_to_stderr);
}
if (url == NULL) {
fprintf(stderr, "You must specify the URL\n");

View File

@@ -368,7 +368,8 @@ int main(int argc, const char *argv[])
}
if (debug > 0) {
iscsi_set_debug(iscsi, debug);
iscsi_set_log_level(iscsi, debug);
iscsi_set_log_fn(iscsi, iscsi_log_to_stderr);
}
iscsi_url = iscsi_parse_portal_url(iscsi, url);

View File

@@ -108,7 +108,8 @@ int main(int argc, const char *argv[])
}
if (debug > 0) {
iscsi_set_debug(iscsi, debug);
iscsi_set_log_fn(iscsi, iscsi_log_to_stderr);
iscsi_set_log_level(iscsi, debug);
}
if (url == NULL) {