Add dynamic timestamp on/off

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1827 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Fabio M. Di Nitto 2009-03-10 13:18:11 +00:00
parent bb87034524
commit 10fa45db6c

View File

@ -42,6 +42,7 @@
#include <arpa/inet.h>
#include <pwd.h>
#include <grp.h>
#include <limits.h>
#include <corosync/corotypes.h>
#include <corosync/list.h>
@ -155,11 +156,19 @@ int corosync_main_config_read_logging (
}
}
if (!objdb_get_string (objdb,object_service_handle, "timestamp", &value)) {
char new_format_buffer[PATH_MAX];
memset(&new_format_buffer, 0, sizeof(new_format_buffer));
if (strcmp (value, "on") == 0) {
logsys_format_set("%t [%6s] %b");
snprintf(new_format_buffer, PATH_MAX-1, "%%t %s", logsys_format_get());
logsys_format_set(new_format_buffer);
} else
if (strcmp (value, "off") == 0) {
logsys_format_set(NULL);
if (!strncmp("%t ", logsys_format_get(), 3)) {
snprintf(new_format_buffer, PATH_MAX-1, "%s", logsys_format_get() + 3);
logsys_format_set(new_format_buffer);
}
} else {
goto parse_error;
}