diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | include/openvswitch/vlog.h | 40 | ||||
-rw-r--r-- | lib/vlog-syn.man | 4 | ||||
-rw-r--r-- | lib/vlog-unixctl.man | 6 | ||||
-rw-r--r-- | lib/vlog.c | 158 | ||||
-rw-r--r-- | lib/vlog.man | 8 | ||||
-rw-r--r-- | python/ovs/vlog.py | 56 | ||||
-rw-r--r-- | tests/test-reconnect.c | 2 | ||||
-rw-r--r-- | tests/test-vconn.c | 2 | ||||
-rw-r--r-- | tests/vlog.at | 6 | ||||
-rw-r--r-- | utilities/nlmon.c | 2 | ||||
-rw-r--r-- | utilities/ovs-appctl.8.in | 10 | ||||
-rw-r--r-- | utilities/ovs-appctl.c | 2 | ||||
-rw-r--r-- | utilities/ovs-benchmark.c | 2 | ||||
-rwxr-xr-x | utilities/ovs-command-compgen-test.bash | 8 | ||||
-rw-r--r-- | utilities/ovs-vsctl.c | 2 | ||||
-rw-r--r-- | vtep/vtep-ctl.c | 2 |
17 files changed, 163 insertions, 150 deletions
@@ -53,6 +53,9 @@ Post-v2.3.0 This is generic tunneling mechanism for userspace datapath. - Support for multicast snooping (IGMPv1 and IGMPv2) - Support for Linux kernels up to 3.18.x + - The documentation now use the term 'destination' to mean one of syslog, + console or file for vlog logging instead of the previously used term + 'facility'. v2.3.0 - 14 Aug 2014 diff --git a/include/openvswitch/vlog.h b/include/openvswitch/vlog.h index 3f71e4bd7..b1c7aa7fa 100644 --- a/include/openvswitch/vlog.h +++ b/include/openvswitch/vlog.h @@ -60,28 +60,29 @@ enum vlog_level { const char *vlog_get_level_name(enum vlog_level); enum vlog_level vlog_get_level_val(const char *name); -/* Facilities that we can log to. */ -#define VLOG_FACILITIES \ - VLOG_FACILITY(SYSLOG, "ovs|%05N|%c%T|%p|%m") \ - VLOG_FACILITY(CONSOLE, "%D{%Y-%m-%dT%H:%M:%SZ}|%05N|%c%T|%p|%m") \ - VLOG_FACILITY(FILE, "%D{%Y-%m-%dT%H:%M:%S.###Z}|%05N|%c%T|%p|%m") -enum vlog_facility { -#define VLOG_FACILITY(NAME, PATTERN) VLF_##NAME, - VLOG_FACILITIES -#undef VLOG_FACILITY - VLF_N_FACILITIES, - VLF_ANY_FACILITY = -1 +/* Destinations that we can log to. */ +#define VLOG_DESTINATIONS \ + VLOG_DESTINATION(SYSLOG, "ovs|%05N|%c%T|%p|%m") \ + VLOG_DESTINATION(CONSOLE, "%D{%Y-%m-%dT%H:%M:%SZ}|%05N|%c%T|%p|%m") \ + VLOG_DESTINATION(FILE, "%D{%Y-%m-%dT%H:%M:%S.###Z}|%05N|%c%T|%p|%m") +enum vlog_destination { +#define VLOG_DESTINATION(NAME, PATTERN) VLF_##NAME, + VLOG_DESTINATIONS +#undef VLOG_DESTINATION + VLF_N_DESTINATIONS, + VLF_ANY_DESTINATION = -1 }; -const char *vlog_get_facility_name(enum vlog_facility); -enum vlog_facility vlog_get_facility_val(const char *name); +const char *vlog_get_destination_name(enum vlog_destination); +enum vlog_destination vlog_get_destination_val(const char *name); /* A log module. */ struct vlog_module { struct ovs_list list; const char *name; /* User-visible name. */ - int levels[VLF_N_FACILITIES]; /* Minimum log level for each facility. */ - int min_level; /* Minimum log level for any facility. */ + int levels[VLF_N_DESTINATIONS]; /* Minimum log level for each + destination. */ + int min_level; /* Minimum log level for any destination. */ bool honor_rate_limits; /* Set false to ignore rate limits. */ }; @@ -125,9 +126,10 @@ struct vlog_rate_limit { } /* Configuring how each module logs messages. */ -enum vlog_level vlog_get_level(const struct vlog_module *, enum vlog_facility); +enum vlog_level vlog_get_level(const struct vlog_module *, + enum vlog_destination); void vlog_set_levels(struct vlog_module *, - enum vlog_facility, enum vlog_level); + enum vlog_destination, enum vlog_level); char *vlog_set_levels_from_string(const char *) OVS_WARN_UNUSED_RESULT; void vlog_set_levels_from_string_assert(const char *); char *vlog_get_levels(void); @@ -136,8 +138,8 @@ bool vlog_should_drop(const struct vlog_module *, enum vlog_level, struct vlog_rate_limit *); void vlog_set_verbosity(const char *arg); -/* Configuring log facilities. */ -void vlog_set_pattern(enum vlog_facility, const char *pattern); +/* Configuring log destinations. */ +void vlog_set_pattern(enum vlog_destination, const char *pattern); int vlog_set_log_file(const char *file_name); int vlog_reopen_log_file(void); diff --git a/lib/vlog-syn.man b/lib/vlog-syn.man index 3df967ad1..09ebdf6ab 100644 --- a/lib/vlog-syn.man +++ b/lib/vlog-syn.man @@ -1,6 +1,6 @@ .IP "Logging options:" -[\fB\-v\fR[\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]]]\&... +[\fB\-v\fR[\fImodule\fR[\fB:\fIdestination\fR[\fB:\fIlevel\fR]]]]\&... .br -[\fB\-\-verbose[=\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]]]\&... +[\fB\-\-verbose[=\fImodule\fR[\fB:\fIdestination\fR[\fB:\fIlevel\fR]]]]\&... .br [\fB\-\-log\-file\fR[\fB=\fIfile\fR]] diff --git a/lib/vlog-unixctl.man b/lib/vlog-unixctl.man index 1890dc2fc..85dd11de0 100644 --- a/lib/vlog-unixctl.man +++ b/lib/vlog-unixctl.man @@ -7,7 +7,7 @@ These commands manage \fB\*(PN\fR's logging settings. .IP "\fBvlog/set\fR [\fIspec\fR]" Sets logging levels. Without any \fIspec\fR, sets the log level for -every module and facility to \fBdbg\fR. Otherwise, \fIspec\fR is a +every module and destination to \fBdbg\fR. Otherwise, \fIspec\fR is a list of words separated by spaces or commas or colons, up to one from each category below: . @@ -44,8 +44,8 @@ will not take place unless \fB\*(PN\fR was invoked with the For compatibility with older versions of OVS, \fBany\fR is accepted as a word but has no effect. .RE -.IP "\fBvlog/set PATTERN:\fIfacility\fB:\fIpattern\fR" -Sets the log pattern for \fIfacility\fR to \fIpattern\fR. Refer to +.IP "\fBvlog/set PATTERN:\fIdestination\fB:\fIpattern\fR" +Sets the log pattern for \fIdestination\fR to \fIpattern\fR. Refer to \fBovs\-appctl\fR(8) for a description of the valid syntax for \fIpattern\fR. . .IP "\fBvlog/list\fR" diff --git a/lib/vlog.c b/lib/vlog.c index dbf46c5ab..c68002772 100644 --- a/lib/vlog.c +++ b/lib/vlog.c @@ -77,21 +77,21 @@ BUILD_ASSERT_DECL(LOG_LOCAL0 == (16 << 3)); /* The log modules. */ struct ovs_list vlog_modules = OVS_LIST_INITIALIZER(&vlog_modules); -/* Protects the 'pattern' in all "struct facility"s, so that a race between +/* Protects the 'pattern' in all "struct destination"s, so that a race between * changing and reading the pattern does not cause an access to freed * memory. */ static struct ovs_rwlock pattern_rwlock = OVS_RWLOCK_INITIALIZER; -/* Information about each facility. */ -struct facility { +/* Information about each destination. */ +struct destination { const char *name; /* Name. */ char *pattern OVS_GUARDED_BY(pattern_rwlock); /* Current pattern. */ bool default_pattern; /* Whether current pattern is the default. */ }; -static struct facility facilities[VLF_N_FACILITIES] = { -#define VLOG_FACILITY(NAME, PATTERN) {#NAME, PATTERN, true}, - VLOG_FACILITIES -#undef VLOG_FACILITY +static struct destination destinations[VLF_N_DESTINATIONS] = { +#define VLOG_DESTINATION(NAME, PATTERN) {#NAME, PATTERN, true}, + VLOG_DESTINATIONS +#undef VLOG_DESTINATION }; /* Sequence number for the message currently being composed. */ @@ -147,23 +147,23 @@ vlog_get_level_val(const char *name) return search_name_array(name, level_names, ARRAY_SIZE(level_names)); } -/* Returns the name for logging facility 'facility'. */ +/* Returns the name for logging destination 'destination'. */ const char * -vlog_get_facility_name(enum vlog_facility facility) +vlog_get_destination_name(enum vlog_destination destination) { - assert(facility < VLF_N_FACILITIES); - return facilities[facility].name; + assert(destination < VLF_N_DESTINATIONS); + return destinations[destination].name; } -/* Returns the logging facility named 'name', or VLF_N_FACILITIES if 'name' is - * not the name of a logging facility. */ -enum vlog_facility -vlog_get_facility_val(const char *name) +/* Returns the logging destination named 'name', or VLF_N_DESTINATIONS if + * 'name' is not the name of a logging destination. */ +enum vlog_destination +vlog_get_destination_val(const char *name) { size_t i; - for (i = 0; i < VLF_N_FACILITIES; i++) { - if (!strcasecmp(facilities[i].name, name)) { + for (i = 0; i < VLF_N_DESTINATIONS; i++) { + if (!strcasecmp(destinations[i].name, name)) { break; } } @@ -198,23 +198,25 @@ vlog_module_from_name(const char *name) return NULL; } -/* Returns the current logging level for the given 'module' and 'facility'. */ +/* Returns the current logging level for the given 'module' and + * 'destination'. */ enum vlog_level -vlog_get_level(const struct vlog_module *module, enum vlog_facility facility) +vlog_get_level(const struct vlog_module *module, + enum vlog_destination destination) { - assert(facility < VLF_N_FACILITIES); - return module->levels[facility]; + assert(destination < VLF_N_DESTINATIONS); + return module->levels[destination]; } static void update_min_level(struct vlog_module *module) OVS_REQUIRES(&log_file_mutex) { - enum vlog_facility facility; + enum vlog_destination destination; module->min_level = VLL_OFF; - for (facility = 0; facility < VLF_N_FACILITIES; facility++) { - if (log_fd >= 0 || facility != VLF_FILE) { - enum vlog_level level = module->levels[facility]; + for (destination = 0; destination < VLF_N_DESTINATIONS; destination++) { + if (log_fd >= 0 || destination != VLF_FILE) { + enum vlog_level level = module->levels[destination]; if (level > module->min_level) { module->min_level = level; } @@ -223,47 +225,49 @@ update_min_level(struct vlog_module *module) OVS_REQUIRES(&log_file_mutex) } static void -set_facility_level(enum vlog_facility facility, struct vlog_module *module, - enum vlog_level level) +set_destination_level(enum vlog_destination destination, + struct vlog_module *module, enum vlog_level level) { - assert(facility >= 0 && facility < VLF_N_FACILITIES); + assert(destination >= 0 && destination < VLF_N_DESTINATIONS); assert(level < VLL_N_LEVELS); ovs_mutex_lock(&log_file_mutex); if (!module) { struct vlog_module *mp; LIST_FOR_EACH (mp, list, &vlog_modules) { - mp->levels[facility] = level; + mp->levels[destination] = level; update_min_level(mp); } } else { - module->levels[facility] = level; + module->levels[destination] = level; update_min_level(module); } ovs_mutex_unlock(&log_file_mutex); } -/* Sets the logging level for the given 'module' and 'facility' to 'level'. A - * null 'module' or a 'facility' of VLF_ANY_FACILITY is treated as a wildcard - * across all modules or facilities, respectively. */ +/* Sets the logging level for the given 'module' and 'destination' to 'level'. + * A null 'module' or a 'destination' of VLF_ANY_DESTINATION is treated as a + * wildcard across all modules or destinations, respectively. */ void -vlog_set_levels(struct vlog_module *module, enum vlog_facility facility, +vlog_set_levels(struct vlog_module *module, enum vlog_destination destination, enum vlog_level level) { - assert(facility < VLF_N_FACILITIES || facility == VLF_ANY_FACILITY); - if (facility == VLF_ANY_FACILITY) { - for (facility = 0; facility < VLF_N_FACILITIES; facility++) { - set_facility_level(facility, module, level); + assert(destination < VLF_N_DESTINATIONS || + destination == VLF_ANY_DESTINATION); + if (destination == VLF_ANY_DESTINATION) { + for (destination = 0; destination < VLF_N_DESTINATIONS; + destination++) { + set_destination_level(destination, module, level); } } else { - set_facility_level(facility, module, level); + set_destination_level(destination, module, level); } } static void -do_set_pattern(enum vlog_facility facility, const char *pattern) +do_set_pattern(enum vlog_destination destination, const char *pattern) { - struct facility *f = &facilities[facility]; + struct destination *f = &destinations[destination]; ovs_rwlock_wrlock(&pattern_rwlock); if (!f->default_pattern) { @@ -275,17 +279,19 @@ do_set_pattern(enum vlog_facility facility, const char *pattern) ovs_rwlock_unlock(&pattern_rwlock); } -/* Sets the pattern for the given 'facility' to 'pattern'. */ +/* Sets the pattern for the given 'destination' to 'pattern'. */ void -vlog_set_pattern(enum vlog_facility facility, const char *pattern) +vlog_set_pattern(enum vlog_destination destination, const char *pattern) { - assert(facility < VLF_N_FACILITIES || facility == VLF_ANY_FACILITY); - if (facility == VLF_ANY_FACILITY) { - for (facility = 0; facility < VLF_N_FACILITIES; facility++) { - do_set_pattern(facility, pattern); + assert(destination < VLF_N_DESTINATIONS || + destination == VLF_ANY_DESTINATION); + if (destination == VLF_ANY_DESTINATION) { + for (destination = 0; destination < VLF_N_DESTINATIONS; + destination++) { + do_set_pattern(destination, pattern); } } else { - do_set_pattern(facility, pattern); + do_set_pattern(destination, pattern); } } @@ -397,36 +403,36 @@ vlog_set_levels_from_string(const char *s_) word = strtok_r(s, " ,:\t", &save_ptr); if (word && !strcasecmp(word, "PATTERN")) { - enum vlog_facility facility; + enum vlog_destination destination; word = strtok_r(NULL, " ,:\t", &save_ptr); if (!word) { - msg = xstrdup("missing facility"); + msg = xstrdup("missing destination"); goto exit; } - facility = (!strcasecmp(word, "ANY") - ? VLF_ANY_FACILITY - : vlog_get_facility_val(word)); - if (facility == VLF_N_FACILITIES) { - msg = xasprintf("unknown facility \"%s\"", word); + destination = (!strcasecmp(word, "ANY") + ? VLF_ANY_DESTINATION + : vlog_get_destination_val(word)); + if (destination == VLF_N_DESTINATIONS) { + msg = xasprintf("unknown destination \"%s\"", word); goto exit; } - vlog_set_pattern(facility, save_ptr); + vlog_set_pattern(destination, save_ptr); } else { struct vlog_module *module = NULL; enum vlog_level level = VLL_N_LEVELS; - enum vlog_facility facility = VLF_N_FACILITIES; + enum vlog_destination destination = VLF_N_DESTINATIONS; for (; word != NULL; word = strtok_r(NULL, " ,:\t", &save_ptr)) { if (!strcasecmp(word, "ANY")) { continue; - } else if (vlog_get_facility_val(word) != VLF_N_FACILITIES) { - if (facility != VLF_N_FACILITIES) { - msg = xstrdup("cannot specify multiple facilities"); + } else if (vlog_get_destination_val(word) != VLF_N_DESTINATIONS) { + if (destination != VLF_N_DESTINATIONS) { + msg = xstrdup("cannot specify multiple destinations"); goto exit; } - facility = vlog_get_facility_val(word); + destination = vlog_get_destination_val(word); } else if (vlog_get_level_val(word) != VLL_N_LEVELS) { if (level != VLL_N_LEVELS) { msg = xstrdup("cannot specify multiple levels"); @@ -440,18 +446,19 @@ vlog_set_levels_from_string(const char *s_) } module = vlog_module_from_name(word); } else { - msg = xasprintf("no facility, level, or module \"%s\"", word); + msg = xasprintf("no destination, level, or module \"%s\"", + word); goto exit; } } - if (facility == VLF_N_FACILITIES) { - facility = VLF_ANY_FACILITY; + if (destination == VLF_N_DESTINATIONS) { + destination = VLF_ANY_DESTINATION; } if (level == VLL_N_LEVELS) { level = VLL_DBG; } - vlog_set_levels(module, facility, level); + vlog_set_levels(module, destination, level); } exit: @@ -480,7 +487,7 @@ vlog_set_verbosity(const char *arg) ovs_fatal(0, "processing \"%s\": %s", arg, msg); } } else { - vlog_set_levels(NULL, VLF_ANY_FACILITY, VLL_DBG); + vlog_set_levels(NULL, VLF_ANY_DESTINATION, VLL_DBG); } } @@ -632,7 +639,7 @@ vlog_init(void) } unixctl_command_register( - "vlog/set", "{spec | PATTERN:facility:pattern}", + "vlog/set", "{spec | PATTERN:destination:pattern}", 1, INT_MAX, vlog_unixctl_set, NULL); unixctl_command_register("vlog/list", "", 0, 0, vlog_unixctl_list, NULL); @@ -879,8 +886,9 @@ vlog_valist(const struct vlog_module *module, enum vlog_level level, ovs_rwlock_rdlock(&pattern_rwlock); if (log_to_console) { - format_log_message(module, level, facilities[VLF_CONSOLE].pattern, - message, args, &s); + format_log_message(module, level, + destinations[VLF_CONSOLE].pattern, message, + args, &s); ds_put_char(&s, '\n'); fputs(ds_cstr(&s), stderr); } @@ -890,7 +898,7 @@ vlog_valist(const struct vlog_module *module, enum vlog_level level, char *save_ptr = NULL; char *line; - format_log_message(module, level, facilities[VLF_SYSLOG].pattern, + format_log_message(module, level, destinations[VLF_SYSLOG].pattern, message, args, &s); for (line = strtok_r(s.string, "\n", &save_ptr); line; line = strtok_r(NULL, "\n", &save_ptr)) { @@ -907,7 +915,7 @@ vlog_valist(const struct vlog_module *module, enum vlog_level level, } if (log_to_file) { - format_log_message(module, level, facilities[VLF_FILE].pattern, + format_log_message(module, level, destinations[VLF_FILE].pattern, message, args, &s); ds_put_char(&s, '\n'); @@ -944,7 +952,7 @@ vlog(const struct vlog_module *module, enum vlog_level level, /* Logs 'message' to 'module' at maximum verbosity, then exits with a failure * exit code. Always writes the message to stderr, even if the console - * facility is disabled. + * destination is disabled. * * Choose this function instead of vlog_abort_valist() if the daemon monitoring * facility shouldn't automatically restart the current daemon. */ @@ -964,7 +972,7 @@ vlog_fatal_valist(const struct vlog_module *module_, /* Logs 'message' to 'module' at maximum verbosity, then exits with a failure * exit code. Always writes the message to stderr, even if the console - * facility is disabled. + * destination is disabled. * * Choose this function instead of vlog_abort() if the daemon monitoring * facility shouldn't automatically restart the current daemon. */ @@ -979,7 +987,7 @@ vlog_fatal(const struct vlog_module *module, const char *message, ...) } /* Logs 'message' to 'module' at maximum verbosity, then calls abort(). Always - * writes the message to stderr, even if the console facility is disabled. + * writes the message to stderr, even if the console destination is disabled. * * Choose this function instead of vlog_fatal_valist() if the daemon monitoring * facility should automatically restart the current daemon. */ @@ -998,7 +1006,7 @@ vlog_abort_valist(const struct vlog_module *module_, } /* Logs 'message' to 'module' at maximum verbosity, then calls abort(). Always - * writes the message to stderr, even if the console facility is disabled. + * writes the message to stderr, even if the console destination is disabled. * * Choose this function instead of vlog_fatal() if the daemon monitoring * facility should automatically restart the current daemon. */ diff --git a/lib/vlog.man b/lib/vlog.man index c62e40711..ddf14d82b 100644 --- a/lib/vlog.man +++ b/lib/vlog.man @@ -7,7 +7,7 @@ .IQ "\fB\-\-verbose=\fR[\fIspec\fR] . Sets logging levels. Without any \fIspec\fR, sets the log level for -every module and facility to \fBdbg\fR. Otherwise, \fIspec\fR is a +every module and destination to \fBdbg\fR. Otherwise, \fIspec\fR is a list of words separated by spaces or commas or colons, up to one from each category below: . @@ -49,9 +49,9 @@ a word but has no effect. Sets the maximum logging verbosity level, equivalent to \fB\-\-verbose=dbg\fR. . -.IP "\fB\-vPATTERN:\fIfacility\fB:\fIpattern\fR" -.IQ "\fB\-\-verbose=PATTERN:\fIfacility\fB:\fIpattern\fR" -Sets the log pattern for \fIfacility\fR to \fIpattern\fR. Refer to +.IP "\fB\-vPATTERN:\fIdestination\fB:\fIpattern\fR" +.IQ "\fB\-\-verbose=PATTERN:\fIdestination\fB:\fIpattern\fR" +Sets the log pattern for \fIdestination\fR to \fIpattern\fR. Refer to \fBovs\-appctl\fR(8) for a description of the valid syntax for \fIpattern\fR. . .TP diff --git a/python/ovs/vlog.py b/python/ovs/vlog.py index 1bd42c46f..105d126fb 100644 --- a/python/ovs/vlog.py +++ b/python/ovs/vlog.py @@ -26,7 +26,7 @@ import ovs.dirs import ovs.unixctl import ovs.util -FACILITIES = {"console": "info", "file": "info", "syslog": "info"} +DESTINATIONS = {"console": "info", "file": "info", "syslog": "info"} PATTERNS = { "console": "%D{%Y-%m-%dT%H:%M:%SZ}|%05N|%c%T|%p|%m", "file": "%D{%Y-%m-%dT%H:%M:%S.###Z}|%05N|%c%T|%p|%m", @@ -50,7 +50,7 @@ class Vlog: __inited = False __msg_num = 0 __start_time = 0 - __mfl = {} # Module -> facility -> level + __mfl = {} # Module -> destination -> level __log_file = None __file_handler = None __log_patterns = PATTERNS @@ -63,7 +63,7 @@ class Vlog: assert not Vlog.__inited self.name = name.lower() if name not in Vlog.__mfl: - Vlog.__mfl[self.name] = FACILITIES.copy() + Vlog.__mfl[self.name] = DESTINATIONS.copy() def __log(self, level, message, **kwargs): if not Vlog.__inited: @@ -79,8 +79,8 @@ class Vlog: msg = self._build_message(message, f, level, msg_num) logging.getLogger(f).log(level_num, msg, **kwargs) - def _build_message(self, message, facility, level, msg_num): - pattern = self.__log_patterns[facility] + def _build_message(self, message, destination, level, msg_num): + pattern = self.__log_patterns[destination] tmp = pattern tmp = self._format_time(tmp) @@ -216,7 +216,7 @@ class Vlog: Vlog.__start_time = datetime.datetime.utcnow() logging.raiseExceptions = False Vlog.__log_file = log_file - for f in FACILITIES: + for f in DESTINATIONS: logger = logging.getLogger(f) logger.setLevel(logging.DEBUG) @@ -241,17 +241,17 @@ class Vlog: Vlog._unixctl_vlog_list, None) @staticmethod - def set_level(module, facility, level): - """ Sets the log level of the 'module'-'facility' tuple to 'level'. + def set_level(module, destination, level): + """ Sets the log level of the 'module'-'destination' tuple to 'level'. All three arguments are strings which are interpreted the same as arguments to the --verbose flag. Should be called after all Vlog objects have already been created.""" module = module.lower() - facility = facility.lower() + destination = destination.lower() level = level.lower() - if facility != "any" and facility not in FACILITIES: + if destination != "any" and destination not in DESTINATIONS: return if module != "any" and module not in Vlog.__mfl: @@ -265,47 +265,47 @@ class Vlog: else: modules = [module] - if facility == "any": - facilities = FACILITIES.keys() + if destination == "any": + destinations = DESTINATIONS.keys() else: - facilities = [facility] + destinations = [destination] for m in modules: - for f in facilities: + for f in destinations: Vlog.__mfl[m][f] = level @staticmethod - def set_pattern(facility, pattern): - """ Sets the log pattern of the 'facility' to 'pattern' """ - facility = facility.lower() - Vlog.__log_patterns[facility] = pattern + def set_pattern(destination, pattern): + """ Sets the log pattern of the 'destination' to 'pattern' """ + destination = destination.lower() + Vlog.__log_patterns[destination] = pattern @staticmethod def set_levels_from_string(s): module = None level = None - facility = None + destination = None words = re.split('[ :]', s) if words[0] == "pattern": try: - if words[1] in FACILITIES and words[2]: + if words[1] in DESTINATIONS and words[2]: segments = [words[i] for i in range(2, len(words))] pattern = "".join(segments) Vlog.set_pattern(words[1], pattern) return else: - return "Facility %s does not exist" % words[1] + return "Destination %s does not exist" % words[1] except IndexError: - return "Please supply a valid pattern and facility" + return "Please supply a valid pattern and destination" for word in [w.lower() for w in words]: if word == "any": pass - elif word in FACILITIES: - if facility: - return "cannot specify multiple facilities" - facility = word + elif word in DESTINATIONS: + if destination: + return "cannot specify multiple destinations" + destination = word elif word in LEVELS: if level: return "cannot specify multiple levels" @@ -315,9 +315,9 @@ class Vlog: return "cannot specify multiple modules" module = word else: - return "no facility, level, or module \"%s\"" % word + return "no destination, level, or module \"%s\"" % word - Vlog.set_level(module or "any", facility or "any", level or "any") + Vlog.set_level(module or "any", destination or "any", level or "any") @staticmethod def get_levels(): diff --git a/tests/test-reconnect.c b/tests/test-reconnect.c index 6e165a287..7d3933910 100644 --- a/tests/test-reconnect.c +++ b/tests/test-reconnect.c @@ -45,7 +45,7 @@ test_reconnect_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) int old_time; char line[128]; - vlog_set_levels(&VLM_reconnect, VLF_ANY_FACILITY, VLL_OFF); + vlog_set_levels(&VLM_reconnect, VLF_ANY_DESTINATION, VLL_OFF); now = 1000; reconnect = reconnect_create(now); diff --git a/tests/test-vconn.c b/tests/test-vconn.c index a05fc638b..187f6f52e 100644 --- a/tests/test-vconn.c +++ b/tests/test-vconn.c @@ -447,7 +447,7 @@ static void test_vconn_main(int argc, char *argv[]) { set_program_name(argv[0]); - vlog_set_levels(NULL, VLF_ANY_FACILITY, VLL_EMER); + vlog_set_levels(NULL, VLF_ANY_DESTINATION, VLL_EMER); vlog_set_levels(NULL, VLF_CONSOLE, VLL_DBG); fatal_ignore_sigpipe(); diff --git a/tests/vlog.at b/tests/vlog.at index 262256578..4a143cdeb 100644 --- a/tests/vlog.at +++ b/tests/vlog.at @@ -208,7 +208,7 @@ unixctl_server info info info AT_CHECK([APPCTL -t test-unixctl.py vlog/set daemon:syslog:err]) AT_CHECK([APPCTL -t test-unixctl.py vlog/set file:dbg]) AT_CHECK([APPCTL -t test-unixctl.py vlog/set nonexistent], [0], - [no facility, level, or module "nonexistent" + [no destination, level, or module "nonexistent" ]) AT_CHECK([APPCTL -t test-unixctl.py vlog/list], [0], [dnl console syslog file @@ -225,10 +225,10 @@ unixctl_server info info dbg ]) AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern], [0], - [Please supply a valid pattern and facility + [Please supply a valid pattern and destination ]) AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern:nonexistent], [0], - [Facility nonexistent does not exist + [Destination nonexistent does not exist ]) AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern:file:'I<3OVS|%m']) AT_CHECK([APPCTL -t test-unixctl.py log patterntest]) diff --git a/utilities/nlmon.c b/utilities/nlmon.c index dc5d8c491..9baa1c283 100644 --- a/utilities/nlmon.c +++ b/utilities/nlmon.c @@ -45,7 +45,7 @@ main(int argc OVS_UNUSED, char *argv[]) int error; set_program_name(argv[0]); - vlog_set_levels(NULL, VLF_ANY_FACILITY, VLL_DBG); + vlog_set_levels(NULL, VLF_ANY_DESTINATION, VLL_DBG); error = nl_sock_create(NETLINK_ROUTE, &sock); if (error) { diff --git a/utilities/ovs-appctl.8.in b/utilities/ovs-appctl.8.in index 247300b3f..238c74ba7 100644 --- a/utilities/ovs-appctl.8.in +++ b/utilities/ovs-appctl.8.in @@ -84,7 +84,7 @@ Open vSwitch has several log levels. The highest-severity log level is: . .IP "\fBoff\fR" No message is ever logged at this level, so setting a logging -facility's log level to \fBoff\fR disables logging to that facility. +destination's log level to \fBoff\fR disables logging to that destination. . .PP The following log levels, in order of descending severity, are @@ -114,7 +114,7 @@ Lists the known logging modules and their current levels. . .IP "\fBvlog/set\fR [\fIspec\fR]" Sets logging levels. Without any \fIspec\fR, sets the log level for -every module and facility to \fBdbg\fR. Otherwise, \fIspec\fR is a +every module and destination to \fBdbg\fR. Otherwise, \fIspec\fR is a list of words separated by spaces or commas or colons, up to one from each category below: . @@ -150,9 +150,9 @@ will not take place unless the target application was invoked with the For compatibility with older versions of OVS, \fBany\fR is accepted as a word but has no effect. . -.IP "\fBvlog/set PATTERN:\fIfacility\fB:\fIpattern\fR" -Sets the log pattern for \fIfacility\fR to \fIpattern\fR. Each time a -message is logged to \fIfacility\fR, \fIpattern\fR determines the +.IP "\fBvlog/set PATTERN:\fIdestination\fB:\fIpattern\fR" +Sets the log pattern for \fIdestination\fR to \fIpattern\fR. Each time a +message is logged to \fIdestination\fR, \fIpattern\fR determines the message's formatting. Most characters in \fIpattern\fR are copied literally to the log, but special escapes beginning with \fB%\fR are expanded as follows: diff --git a/utilities/ovs-appctl.c b/utilities/ovs-appctl.c index 5c39a8f28..dee2d33a4 100644 --- a/utilities/ovs-appctl.c +++ b/utilities/ovs-appctl.c @@ -95,7 +95,7 @@ Common commands:\n\ vlog/set [SPEC]\n\ Set log levels as detailed in SPEC, which may include:\n\ A valid module name (all modules, by default)\n\ - 'syslog', 'console', 'file' (all facilities, by default))\n\ + 'syslog', 'console', 'file' (all destinations, by default))\n\ 'off', 'emer', 'err', 'warn', 'info', or 'dbg' ('dbg', bydefault)\n\ vlog/reopen Make the program reopen its log file\n\ Other options:\n\ diff --git a/utilities/ovs-benchmark.c b/utilities/ovs-benchmark.c index a0927461b..64db63e6e 100644 --- a/utilities/ovs-benchmark.c +++ b/utilities/ovs-benchmark.c @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) { set_program_name(argv[0]); - vlog_set_levels(NULL, VLF_ANY_FACILITY, VLL_EMER); + vlog_set_levels(NULL, VLF_ANY_DESTINATION, VLL_EMER); parse_options(argc, argv); run_command(argc - optind, argv + optind, get_all_commands()); return 0; diff --git a/utilities/ovs-command-compgen-test.bash b/utilities/ovs-command-compgen-test.bash index 9de0d12a5..3de6482f7 100755 --- a/utilities/ovs-command-compgen-test.bash +++ b/utilities/ovs-command-compgen-test.bash @@ -464,7 +464,7 @@ print_result "complex completion check - ofproto/trace" "$TEST_RESULT" # complex completion check - vlog/set -# vlog/set {spec | PATTERN:facility:pattern} +# vlog/set {spec | PATTERN:destination:pattern} # test non expandable arguments reset_globals @@ -473,7 +473,7 @@ for i in loop_once; do # check the top level completion. COMP_OUTPUT="$(bash ovs-command-compgen.bash debug ovs-appctl vlog/set TAB 2>&1)" TMP="$(get_argument_expansion "$COMP_OUTPUT" | sed -e 's/[ \t]*$//')" - EXPECT="$(generate_expect_completions "PATTERN:facility:pattern" "") + EXPECT="$(generate_expect_completions "PATTERN:destination:pattern" "") $(generate_expect_completions "spec" "")" if [ "$TMP" != "$EXPECT" ]; then print_error "1" "$TMP" "$EXPECT" @@ -494,7 +494,7 @@ $(generate_expect_completions "spec" "")" COMP_OUTPUT="$(bash ovs-command-compgen.bash debug ovs-appctl vlog/set abcd TAB 2>&1)" TMP="$(sed -e '/./,$!d' <<< "$COMP_OUTPUT")" EXPECT="Command format: -vlog/set {spec | PATTERN:facility:pattern}" +vlog/set {spec | PATTERN:destination:pattern}" if [ "$TMP" != "$EXPECT" ]; then print_error "3" "$TMP" "$EXPECT" TEST_RESULT=fail @@ -685,4 +685,4 @@ for i in loop_once; do TEST_RESULT=ok done -print_result "negative test - do not match on nested option" "$TEST_RESULT"
\ No newline at end of file +print_result "negative test - do not match on nested option" "$TEST_RESULT" diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index 4f9fd4730..8b642453c 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -207,7 +207,7 @@ main(int argc, char *argv[]) set_program_name(argv[0]); fatal_ignore_sigpipe(); vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN); - vlog_set_levels(&VLM_reconnect, VLF_ANY_FACILITY, VLL_WARN); + vlog_set_levels(&VLM_reconnect, VLF_ANY_DESTINATION, VLL_WARN); ovsrec_init(); /* Log our arguments. This is often valuable for debugging systems. */ diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c index c1a657d09..7a7fd8873 100644 --- a/vtep/vtep-ctl.c +++ b/vtep/vtep-ctl.c @@ -168,7 +168,7 @@ main(int argc, char *argv[]) set_program_name(argv[0]); fatal_ignore_sigpipe(); vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN); - vlog_set_levels(&VLM_reconnect, VLF_ANY_FACILITY, VLL_WARN); + vlog_set_levels(&VLM_reconnect, VLF_ANY_DESTINATION, VLL_WARN); vteprec_init(); /* Log our arguments. This is often valuable for debugging systems. */ |