Skip to content

Commit

Permalink
ovs-appctl: Add logging options.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Ansis Atteka <[email protected]>
  • Loading branch information
blp committed Aug 4, 2014
1 parent fceef20 commit 9664732
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions utilities/ovs-appctl.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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[]);
Expand Down Expand Up @@ -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;

Expand All @@ -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;
}
Expand Down Expand Up @@ -158,13 +165,17 @@ parse_command_line(int argc, char *argv[])
ovs_print_version(0, 0);
exit(EXIT_SUCCESS);

VLOG_OPTION_HANDLERS

case '?':
exit(EXIT_FAILURE);

default:
OVS_NOT_REACHED();
}
}
free(short_options_);
free(short_options);

if (optind >= argc) {
ovs_fatal(0, "at least one non-option argument is required "
Expand Down

0 comments on commit 9664732

Please sign in to comment.