All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch 2/3] chunkd: End-to-end verbosity v3
@ 2010-04-13 20:30 Pete Zaitcev
  2010-04-14  4:35 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Pete Zaitcev @ 2010-04-13 20:30 UTC (permalink / raw)
  To: jeff; +Cc: Project Hail List

Signed-Off-By: Pete Zaitcev <zaitcev@redhat.com>

---
 pkg/chunkd.sysconf |    2 +-
 server/cldu.c      |    3 ++-
 server/server.c    |   22 ++++++++++++++++------
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/pkg/chunkd.sysconf b/pkg/chunkd.sysconf
index 7272a0d..122b524 100644
--- a/pkg/chunkd.sysconf
+++ b/pkg/chunkd.sysconf
@@ -2,5 +2,5 @@
 #
 
 #example:
-#OPTS="--debug"
+#OPTS="--debug 1"
 
diff --git a/server/cldu.c b/server/cldu.c
index 51d01a3..b2d3388 100644
--- a/server/cldu.c
+++ b/server/cldu.c
@@ -319,7 +319,8 @@ static int cldu_set_cldc(struct cld_session *cs, int newactive)
 		       hp->host, hp->port);
 
 	cs->nsess = ncld_sess_open(hp->host, hp->port, &error,
-				   cldu_sess_event, cs, "tabled", "tabled");
+				   cldu_sess_event, cs, "tabled", "tabled",
+				   &cldu_hail_log);
 	if (cs->nsess == NULL) {
 		if (error < 1000) {
 			applog(LOG_ERR, "ncld_sess_open(%s,%u) error: %s",
diff --git a/server/server.c b/server/server.c
index 69f3973..f367676 100644
--- a/server/server.c
+++ b/server/server.c
@@ -66,8 +66,8 @@ enum {
 static struct argp_option options[] = {
 	{ "config", 'C', "FILE", 0,
 	  "Read master configuration from FILE" },
-	{ "debug", 'D', NULL, 0,
-	  "Enable debug output" },
+	{ "debug", 'D', "LEVEL", 0,
+	  "Set debug output to LEVEL (0 = off, 2 = max)" },
 	{ "stderr", 'E', NULL, 0,
 	  "Switch the log to standard error" },
 	{ "foreground", 'F', NULL, 0,
@@ -170,12 +170,24 @@ void applog(int prio, const char *fmt, ...)
 
 static error_t parse_opt (int key, char *arg, struct argp_state *state)
 {
+	int v;
+
 	switch(key) {
 	case 'C':
 		chunkd_srv.config = arg;
 		break;
 	case 'D':
-		debugging = 1;
+		v = atoi(arg);
+		if (v < 0 || v > 2) {
+			fprintf(stderr, "invalid debug level: '%s'\n", arg);
+			argp_usage(state);
+		}
+		if (v >= 1)
+			debugging = 1;
+		if (v >= 2) {
+			cldu_hail_log.debug = true;
+			cldu_hail_log.verbose = true;
+		}
 		break;
 	case 'E':
 		use_syslog = false;
@@ -1736,9 +1748,7 @@ int main (int argc, char *argv[])
 	if (use_syslog)
 		openlog(PROGRAM_NAME, LOG_PID, LOG_LOCAL3);
 	if (debugging)
-		applog(LOG_INFO, "Verbose debug output enabled");
-
-	cldu_hail_log.verbose = debugging;
+		applog(LOG_INFO, "Debug output enabled");
 
 	g_thread_init(NULL);
 	chunkd_srv.bigmutex = g_mutex_new();

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch 2/3] chunkd: End-to-end verbosity v3
  2010-04-13 20:30 [Patch 2/3] chunkd: End-to-end verbosity v3 Pete Zaitcev
@ 2010-04-14  4:35 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2010-04-14  4:35 UTC (permalink / raw)
  To: Pete Zaitcev; +Cc: Project Hail List

On 04/13/2010 04:30 PM, Pete Zaitcev wrote:
> Signed-Off-By: Pete Zaitcev<zaitcev@redhat.com>
>
> ---
>   pkg/chunkd.sysconf |    2 +-
>   server/cldu.c      |    3 ++-
>   server/server.c    |   22 ++++++++++++++++------
>   3 files changed, 19 insertions(+), 8 deletions(-)

applied


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-14  4:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-13 20:30 [Patch 2/3] chunkd: End-to-end verbosity v3 Pete Zaitcev
2010-04-14  4:35 ` Jeff Garzik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.