From 10fa45db6c362c1a66b6534b682ffcf4b9f7728f Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 10 Mar 2009 13:18:11 +0000 Subject: [PATCH] Add dynamic timestamp on/off git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1827 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/mainconfig.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/exec/mainconfig.c b/exec/mainconfig.c index 951939ea..27834b70 100644 --- a/exec/mainconfig.c +++ b/exec/mainconfig.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -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; }