]> rtime.felk.cvut.cz Git - frescor/fwp.git/commitdiff
The logging updated to allow full loglevels control.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Tue, 26 May 2009 04:09:03 +0000 (06:09 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Tue, 26 May 2009 04:09:03 +0000 (06:09 +0200)
uLUt update to actual version is required.

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
fwp/lib/frsh_fwp/fwp_fra.c
fwp/mngr/fwp_mngr.c

index a0e3d55578485f20f6391209330cd7126447e254..b466306cb774653a3878757b38469e7b50386f4a 100644 (file)
@@ -44,6 +44,7 @@
 /* covered by the GNU Public License.                                    */
 /**************************************************************************/
 #include <ul_log.h>
+#include <ul_logreg.h>
 #include <fra_generic.h>
 #include <fwp.h>
 //#include <fwp_fna.h>
@@ -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)
 {
index 4d21f2f0c3bc1f440d05f1be3c1f2c72fdc72ba2..4c3920c0b74389e7b0ec5c9ce371b8a4114b6893 100644 (file)
 #include <forb.h>
 #include <error.h>
 #include <errno.h>
+#include <getopt.h>
 #include <fres_sa_scenario.h>
 #include <stdbool.h>
 #include <ul_log.h>
+#include <ul_logreg.h>
 #include <fwp_res.h>
 #include <stdio.h>
 #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 <number>|<domain>=<number>,...\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");