This is a multi-part message in MIME format.
--------------090505010502000502090305
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
So, I started looking into revamping the event queue logic, but ended up
with a migraine from the cumbersome way logging is done, so I decided to
try doing something about it, and the attached 3-patch series is the
result from it.
It compiles alright, both for nagios and the cgi's. I haven't done much
in the way of checking past that though, so testing would be welcome.
Given that the patches don't change much in the way of logic, they
shouldn't really affect anything in significant way.
--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
--------------090505010502000502090305
Content-Type: text/x-patch;
name="0001-Add-gcc-__attribute__-to-printf-like-functions.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename*0="0001-Add-gcc-__attribute__-to-printf-like-functions.patch"
From dfc8dc65f63a39335ff75daa25aa40fd42067d25 Mon Sep 17 00:00:00 2001
From: Andreas Ericsson
Date: Sun, 14 Oct 2007 12:29:55 +0200
Subject: Add gcc __attribute__ to printf()-like functions
So far, it's only used for log_debug_info(), but we'll
make heavy use of it when reworking the rest of the
logging gui, so we well introduce it straight away.
In itself, this is a good patch as it lets the compiler
catch errors in the printf() format argument, and
__attribute__ can also be used to provide a fair few
other compiler hints.
Signed-off-by: Andreas Ericsson
---
include/nagios.h.in | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/include/nagios.h.in b/include/nagios.h.in
index 4df56ea..a96be85 100644
--- a/include/nagios.h.in
+++ b/include/nagios.h.in
@@ -21,6 +21,10 @@
#ifndef _NAGIOS_H
#define _NAGIOS_H
+#ifndef __GNUC__
+# define __attribute__(x) /* nothing */
+#endif
+
#include "config.h"
#include "common.h"
#include "locations.h"
@@ -582,7 +586,8 @@ int log_service_states(int,time_t *); /* logs initial/current
int rotate_log_file(time_t); /* rotates the main log file */
int write_log_file_info(time_t *); /* records log file/version info */
int open_debug_log(void);
-int log_debug_info(int,int,const char *,...);
+int log_debug_info(int,int,const char *,...)
+ __attribute__((__format__(__printf__, 3, 4)));
int close_debug_log(void);
--
1.5.3.3.131.g34c6d
--------------090505010502000502090305
Content-Type: text/x-patch;
name="0002-Extend-the-logging-API-with-a-syslog-style-wrapper.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename*0="0002-Extend-the-logging-API-with-a-syslog-style-wrapper.patc";
filename*1="h"
From 83517648115de352d20dcf8c1d5c2fe4bcb535a2 Mon Sep 17 00:00:00 2001
From: Andreas Ericsson
Date: Sun, 14 Oct 2007 12:50:36 +0200
Subject: Extend the logging API with a syslog() style wrapper
Currently the code is sprinkled with stuff like this:
---%
---
base/logging.c | 20 ++++++++++++++++++++
include/nagios.h.in | 2 ++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/base/logging.c b/base/logging.c
index cfaef70..9bf93fe 100644
--- a/base/logging.c
+++ b/base/logging.c
@@ -97,6 +97,26 @@ int write_to_logs_and_console(char *buffer, unsigned long data_type, int display
return OK;
}
+/* This needs to be a function rather than a macro. C99 introduces
+ * variadic macros, but we need to support compilers that aren't
+ * C99 co
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]