Cleanup zed logging

This is a set of minor cleanup changes related to zed logging:
- Remove the program identity prefix from messages written to stderr
  since systemd already prepends this output with the program name.
- Replace the copy of the program identity string with a ptr reference.
- Replace "pid" with "PID" for consistency in comments & strings.
- Rename the zed_log.c struct _ctx component "level" to "priority".
- Add the LOG_PID option for messages written to syslog.

Signed-off-by: Chris Dunlap <cdunlap@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #2252
This commit is contained in:
Chris Dunlap
2014-08-28 14:39:48 -07:00
committed by Brian Behlendorf
parent 5a8855b716
commit 8125fb7190
4 changed files with 58 additions and 62 deletions
+7 -7
View File
@@ -103,7 +103,7 @@ zed_conf_destroy(struct zed_conf *zcp)
if (zcp->pid_file) {
if ((unlink(zcp->pid_file) < 0) && (errno != ENOENT))
zed_log_msg(LOG_WARNING,
"Failed to remove pid file \"%s\": %s",
"Failed to remove PID file \"%s\": %s",
zcp->pid_file, strerror(errno));
}
if (zcp->conf_file)
@@ -450,14 +450,14 @@ zed_conf_write_pid(struct zed_conf *zcp)
if (!zcp || !zcp->pid_file) {
errno = EINVAL;
zed_log_msg(LOG_ERR, "Failed to write pid file: %s",
zed_log_msg(LOG_ERR, "Failed to write PID file: %s",
strerror(errno));
return (-1);
}
n = strlcpy(dirbuf, zcp->pid_file, sizeof (dirbuf));
if (n >= sizeof (dirbuf)) {
errno = ENAMETOOLONG;
zed_log_msg(LOG_WARNING, "Failed to write pid file: %s",
zed_log_msg(LOG_WARNING, "Failed to write PID file: %s",
strerror(errno));
return (-1);
}
@@ -479,13 +479,13 @@ zed_conf_write_pid(struct zed_conf *zcp)
umask(mask);
if (!fp) {
zed_log_msg(LOG_WARNING, "Failed to open pid file \"%s\": %s",
zed_log_msg(LOG_WARNING, "Failed to open PID file \"%s\": %s",
zcp->pid_file, strerror(errno));
} else if (fprintf(fp, "%d\n", (int) getpid()) == EOF) {
zed_log_msg(LOG_WARNING, "Failed to write pid file \"%s\": %s",
zed_log_msg(LOG_WARNING, "Failed to write PID file \"%s\": %s",
zcp->pid_file, strerror(errno));
} else if (fclose(fp) == EOF) {
zed_log_msg(LOG_WARNING, "Failed to close pid file \"%s\": %s",
zed_log_msg(LOG_WARNING, "Failed to close PID file \"%s\": %s",
zcp->pid_file, strerror(errno));
} else {
return (0);
@@ -564,7 +564,7 @@ zed_conf_open_state(struct zed_conf *zcp)
zcp->state_file);
} else if (pid > 0) {
zed_log_msg(LOG_WARNING,
"Found pid %d bound to state file \"%s\"",
"Found PID %d bound to state file \"%s\"",
pid, zcp->state_file);
} else {
zed_log_msg(LOG_WARNING,