From 13d1d102f8e90ce355d8a1024bc52ec0158e2e10 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 5 Jul 2004 22:23:03 +0000 Subject: [PATCH] add some log helpers --- include/sigar_log.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/sigar_log.h b/include/sigar_log.h index d7bd0d79..43353da8 100644 --- a/include/sigar_log.h +++ b/include/sigar_log.h @@ -28,6 +28,21 @@ #define SIGAR_LOG_IS_TRACE(sigar) \ (sigar->log_level >= SIGAR_LOG_TRACE) +#define SIGAR_STRINGIFY(n) #n + +#define SIGAR_LOG_FILELINE \ + __FILE__ ":" SIGAR_STRINGIFY(__LINE__) + +#if defined(__GNUC__) +# if (__GNUC__ > 2) +# define SIGAR_FUNC __func__ +# else +# define SIGAR_FUNC __FUNCTION__ +# endif +#else +# define SIGAR_FUNC SIGAR_LOG_FILELINE +#endif + typedef void (*sigar_log_impl_t)(sigar_t *, void *, int, char *); SIGAR_DECLARE(void) sigar_log_printf(sigar_t *sigar, int level,