Skip to content

Commit

Permalink
vlog: Rename the currently used term 'facility' as 'destination'.
Browse files Browse the repository at this point in the history
In OVS, we currently use the term 'facility' to mean the place
where we log (syslog, console or file). In Linux's syslog() and
rfc5424, the term 'facility' is used to specify what type of program
is logging the message (e.g: LOG_DAEMON). This causes confusion
while reading vlog's code. This commit changes the term 'facility'
to 'destination'.

Signed-off-by: Gurucharan Shetty <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
shettyg committed Jan 8, 2015
1 parent 4c75aaa commit d546048
Show file tree
Hide file tree
Showing 17 changed files with 163 additions and 150 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 21 additions & 19 deletions include/openvswitch/vlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
};

Expand Down Expand Up @@ -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);
Expand All @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions lib/vlog-syn.man
Original file line number Diff line number Diff line change
@@ -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]]
6 changes: 3 additions & 3 deletions lib/vlog-unixctl.man
Original file line number Diff line number Diff line change
Expand Up @@ -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:
.
Expand Down Expand Up @@ -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"
Expand Down
Loading

0 comments on commit d546048

Please sign in to comment.