From bf466a54a10293067765bf767c572cbf09bcd170 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 29 Apr 2015 03:42:43 +0200 Subject: New error reporting public interface --- pcilib/error.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'pcilib/error.h') diff --git a/pcilib/error.h b/pcilib/error.h index d923d3f..5b5f8b1 100644 --- a/pcilib/error.h +++ b/pcilib/error.h @@ -2,7 +2,8 @@ #define _PCILIB_ERROR_H #include - +#include + enum { PCILIB_ERROR_SUCCESS = 0, PCILIB_ERROR_MEMORY = ENOMEM, @@ -25,8 +26,14 @@ enum { PCILIB_ERROR_BUSY = EBUSY } pcilib_errot_t; -void pcilib_print_error(const char *msg, ...); -extern void (*pcilib_error)(const char *msg, ...); -extern void (*pcilib_warning)(const char *msg, ...); +void pcilib_log_message(const char *file, int line, pcilib_log_priority_t prio, const char *msg, ...); + +#define pcilib_log(prio, ...) \ + pcilib_log_message(__FILE__, __LINE__, prio, __VA_ARGS__) + +#define pcilib_error(...) pcilib_log(PCILIB_LOG_ERROR, __VA_ARGS__) +#define pcilib_warning(...) pcilib_log(PCILIB_LOG_WARNING, __VA_ARGS__) +#define pcilib_info(...) pcilib_log(PCILIB_LOG_INFO, __VA_ARGS__) + #endif /* _PCILIB_ERROR_H */ -- cgit v1.2.3