#define ovs_assert use_assert_instead_of_ovs_assert_in_this_module
/* Name for each logging level. */
-static const char *level_names[VLL_N_LEVELS] = {
+static const char *const level_names[VLL_N_LEVELS] = {
#define VLOG_LEVEL(NAME, SYSLOG_LEVEL) #NAME,
VLOG_LEVELS
#undef VLOG_LEVEL
};
/* Syslog value for each logging level. */
-static int syslog_levels[VLL_N_LEVELS] = {
+static const int syslog_levels[VLL_N_LEVELS] = {
#define VLOG_LEVEL(NAME, SYSLOG_LEVEL) SYSLOG_LEVEL,
VLOG_LEVELS
#undef VLOG_LEVEL
/* Searches the 'n_names' in 'names'. Returns the index of a match for
* 'target', or 'n_names' if no name matches. */
static size_t
-search_name_array(const char *target, const char **names, size_t n_names)
+search_name_array(const char *target, const char *const *names, size_t n_names)
{
size_t i;
/* Log success or failure. */
if (log_fd < 0) {
VLOG_WARN("failed to open %s for logging: %s",
- log_file_name, strerror(errno));
+ log_file_name, ovs_strerror(errno));
error = errno;
} else {
VLOG_INFO("opened log file %s", log_file_name);
if (log_file_name) {
int error = vlog_reopen_log_file();
if (error) {
- unixctl_command_reply_error(conn, strerror(errno));
+ unixctl_command_reply_error(conn, ovs_strerror(errno));
} else {
unixctl_command_reply(conn, NULL);
}
now = time_wall();
if (now < 0) {
- struct tm tm;
- char s[128];
-
- gmtime_r(&now, &tm);
- strftime(s, sizeof s, "%a, %d %b %Y %H:%M:%S", &tm);
+ char *s = xastrftime("%a, %d %b %Y %H:%M:%S", now, true);
VLOG_ERR("current time is negative: %s (%ld)", s, (long int) now);
+ free(s);
}
unixctl_command_register(
break;
case 'd':
p = fetch_braces(p, "%Y-%m-%d %H:%M:%S", tmp, sizeof tmp);
- ds_put_strftime(s, tmp, false);
+ ds_put_strftime(s, tmp, time_wall(), false);
break;
case 'D':
p = fetch_braces(p, "%Y-%m-%d %H:%M:%S", tmp, sizeof tmp);
- ds_put_strftime(s, tmp, true);
+ ds_put_strftime(s, tmp, time_wall(), true);
break;
case 'm':
/* Format user-supplied log message and trim trailing new-lines. */