From 7550df0db83e4862a09ce52e3ee9718de9c4ea92 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Tue, 26 May 2009 06:09:03 +0200 Subject: [PATCH] The logging updated to allow full loglevels control. uLUt update to actual version is required. Signed-off-by: Pavel Pisa --- fwp/lib/frsh_fwp/fwp_fra.c | 2 ++ fwp/mngr/fwp_mngr.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/fwp/lib/frsh_fwp/fwp_fra.c b/fwp/lib/frsh_fwp/fwp_fra.c index a0e3d55..b466306 100644 --- a/fwp/lib/frsh_fwp/fwp_fra.c +++ b/fwp/lib/frsh_fwp/fwp_fra.c @@ -44,6 +44,7 @@ /* covered by the GNU Public License. */ /**************************************************************************/ #include +#include #include #include //#include @@ -55,6 +56,7 @@ UL_LOG_CUST(ulogd_fra_fwp); ul_log_domain_t ulogd_fra_fwp = {UL_LOGL_MSG, "fra_fwp"}; +UL_LOGREG_SINGLE_DOMAIN_INIT_FUNCTION(fra_fwp_logreg_domains, ulogd_fra_fwp); static int create_vres(fres_vres_t *vres, void *priv) { diff --git a/fwp/mngr/fwp_mngr.c b/fwp/mngr/fwp_mngr.c index 4d21f2f..4c3920c 100644 --- a/fwp/mngr/fwp_mngr.c +++ b/fwp/mngr/fwp_mngr.c @@ -47,9 +47,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include "fwp_admctrl.h" @@ -89,12 +91,37 @@ static const struct fres_res_manager frm = { .priv = NULL }; +static struct option long_opts[] = { + { "loglevel", 1, 0, 'l' }, + { 0, 0, 0, 0} +}; + +static void +usage(void) +{ + printf("usage: fwpmngr [ options ]\n"); + printf(" -l, --loglevel |=,...\n"); +} + int main(int argc, char *argv[]) { forb_orb orb; int ret; - forb_init_attr_t attr = { .orb_id = "org.frescor.frm.fwp" }; + int opt; + + 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); + } + } + orb = forb_init(&argc, &argv, &attr); if (!orb) error(1, errno, "forb_init"); -- 2.39.2