From 8da61292f595c5e700a4fef981b0e0d07910b4b2 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Thu, 30 Apr 2015 19:51:49 +0200 Subject: Provide an interface for logging debug messages --- pcilib/error.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pcilib/error.c') diff --git a/pcilib/error.c b/pcilib/error.c index 538534b..ad38622 100644 --- a/pcilib/error.c +++ b/pcilib/error.c @@ -19,13 +19,19 @@ static pcilib_logger_t pcilib_logger = pcilib_print_error; void pcilib_log_message(const char *file, int line, pcilib_log_priority_t prio, const char *msg, ...) { va_list va; - if (prio >= pcilib_logger_min_prio) { + if ((!prio)||(prio >= pcilib_logger_min_prio)) { va_start(va, msg); pcilib_logger(pcilib_logger_argument, file, line, prio, msg, va); va_end(va); } } +void pcilib_log_vmessage(const char *file, int line, pcilib_log_priority_t prio, const char *msg, va_list va) { + if ((!prio)||(prio >= pcilib_logger_min_prio)) { + pcilib_logger(pcilib_logger_argument, file, line, prio, msg, va); + } +} + int pcilib_set_logger(pcilib_log_priority_t min_prio, pcilib_logger_t logger, void *arg) { pcilib_logger_min_prio = min_prio; -- cgit v1.2.3