add some log helpers

This commit is contained in:
Doug MacEachern 2004-07-05 22:23:03 +00:00
parent 4310cba4c7
commit 13d1d102f8
1 changed files with 15 additions and 0 deletions

View File

@ -28,6 +28,21 @@
#define SIGAR_LOG_IS_TRACE(sigar) \ #define SIGAR_LOG_IS_TRACE(sigar) \
(sigar->log_level >= SIGAR_LOG_TRACE) (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 *); typedef void (*sigar_log_impl_t)(sigar_t *, void *, int, char *);
SIGAR_DECLARE(void) sigar_log_printf(sigar_t *sigar, int level, SIGAR_DECLARE(void) sigar_log_printf(sigar_t *sigar, int level,