From: Michal Sojka Date: Mon, 25 May 2009 18:23:36 +0000 (+0200) Subject: FCB learned option to change verbosity X-Git-Url: http://rtime.felk.cvut.cz/gitweb/frescor/frsh.git/commitdiff_plain/e45505a4a39997634d22564da993502773085367 FCB learned option to change verbosity --- diff --git a/fres/cbroker/fcb.c b/fres/cbroker/fcb.c index 1ed13b1..77103a4 100644 --- a/fres/cbroker/fcb.c +++ b/fres/cbroker/fcb.c @@ -53,6 +53,7 @@ * * */ +#include #include #include #include @@ -62,6 +63,7 @@ #include #include #include +#include #include #include #include "fcb_config.h" @@ -939,6 +941,18 @@ void peer_dead_callback(const forb_orb peer_orb, const char *orb_id) { } +static struct option long_opts[] = { + { "loglevel", 1, 0, 'l' }, + { 0, 0, 0, 0} +}; + +static void +usage(void) +{ + printf("usage: fcb [ options ]\n"); + printf(" -l, --loglevel |=,...\n"); +} + int main(int argc, char *argv[]) { forb_orb orb; @@ -951,7 +965,21 @@ int main(int argc, char *argv[]) .peer_discovery_callback = peer_discovery_callback, .peer_dead_callback = peer_dead_callback, }; - + int opt; + + ul_logreg_domain(&ulogd_fcb); + + while ((opt = getopt_long(argc, argv, "l:", &long_opts[0], NULL)) != EOF) { + switch (opt) { + case 'l': + ul_log_domain_arg2levels(optarg); + break; + case 'h': + default: + usage(); + exit(opt == 'h' ? 0 : 1); + } + } fosa_clock_get_time(CLOCK_REALTIME, &start_time);