1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
From 9664732f4cd90b741b840db8a8ed24939d227c2e Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@nicira.com>
Date: Mon, 4 Aug 2014 12:36:04 -0700
Subject: [PATCH] ovs-appctl: Add logging options.
Normally I would also add documentation for the logging options to the
ovs-appctl manpage, but I am concerned that in this case it would actually
make the manpage confusing, because one of the main purposes of ovs-appctl
is to modify the log levels of *other* programs, and these options only
modify the log level of ovs-appctl itself, which is rarely useful.
The following commit will start using these logging options in a test.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ansis Atteka <aatteka@nicira.com>
---
utilities/ovs-appctl.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/utilities/ovs-appctl.c b/utilities/ovs-appctl.c
index a6fbebd..bb17ec2 100644
--- a/utilities/ovs-appctl.c
+++ b/utilities/ovs-appctl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@
#include "timeval.h"
#include "unixctl.h"
#include "util.h"
+#include "vlog.h"
static void usage(void);
static const char *parse_command_line(int argc, char *argv[]);
@@ -108,14 +109,20 @@ Other options:\n\
static const char *
parse_command_line(int argc, char *argv[])
{
+ enum {
+ VLOG_OPTION_ENUMS
+ };
static const struct option long_options[] = {
{"target", required_argument, NULL, 't'},
{"execute", no_argument, NULL, 'e'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{"timeout", required_argument, NULL, 'T'},
+ VLOG_LONG_OPTIONS,
{NULL, 0, NULL, 0},
};
+ char *short_options_ = long_options_to_short_options(long_options);
+ char *short_options = xasprintf("+%s", short_options_);
const char *target;
int e_options;
@@ -124,7 +131,7 @@ parse_command_line(int argc, char *argv[])
for (;;) {
int option;
- option = getopt_long(argc, argv, "+t:hVe", long_options, NULL);
+ option = getopt_long(argc, argv, short_options, long_options, NULL);
if (option == -1) {
break;
}
@@ -158,6 +165,8 @@ parse_command_line(int argc, char *argv[])
ovs_print_version(0, 0);
exit(EXIT_SUCCESS);
+ VLOG_OPTION_HANDLERS
+
case '?':
exit(EXIT_FAILURE);
@@ -165,6 +174,8 @@ parse_command_line(int argc, char *argv[])
OVS_NOT_REACHED();
}
}
+ free(short_options_);
+ free(short_options);
if (optind >= argc) {
ovs_fatal(0, "at least one non-option argument is required "
--
1.9.1
|