log FEATURE supply session as log clb parameter
Refs #306
diff --git a/src/log_p.h b/src/log_p.h
index 124b9ed..d3afc4a 100644
--- a/src/log_p.h
+++ b/src/log_p.h
@@ -24,11 +24,13 @@
*/
/**
- * @brief internal printing function
+ * @brief Internal printing function
+ *
+ * @param[in] session Optional NETCONF session that generated the message
* @param[in] level Verbose level
* @param[in] format Formatting string
*/
-void prv_printf(NC_VERB_LEVEL level, const char *format, ...);
+void prv_printf(const struct nc_session *session, NC_VERB_LEVEL level, const char *format, ...);
/**
* @brief Verbose level variable
@@ -38,15 +40,15 @@
/*
* Verbose printing macros
*/
-#define ERR(format, args ...) prv_printf(NC_VERB_ERROR,format,##args)
-#define WRN(format, args ...) if(verbose_level>=NC_VERB_WARNING){prv_printf(NC_VERB_WARNING,format,##args);}
-#define VRB(format, args ...) if(verbose_level>=NC_VERB_VERBOSE){prv_printf(NC_VERB_VERBOSE,format,##args);}
-#define DBG(format, args ...) if(verbose_level>=NC_VERB_DEBUG){prv_printf(NC_VERB_DEBUG,format,##args);}
-#define DBL(format, args ...) if(verbose_level>=NC_VERB_DEBUG_LOWLVL){prv_printf(NC_VERB_DEBUG_LOWLVL,format,##args);}
+#define ERR(session, format, args ...) prv_printf(session,NC_VERB_ERROR,format,##args)
+#define WRN(session, format, args ...) if(verbose_level>=NC_VERB_WARNING){prv_printf(session,NC_VERB_WARNING,format,##args);}
+#define VRB(session, format, args ...) if(verbose_level>=NC_VERB_VERBOSE){prv_printf(session,NC_VERB_VERBOSE,format,##args);}
+#define DBG(session, format, args ...) if(verbose_level>=NC_VERB_DEBUG){prv_printf(session,NC_VERB_DEBUG,format,##args);}
+#define DBL(session, format, args ...) if(verbose_level>=NC_VERB_DEBUG_LOWLVL){prv_printf(session,NC_VERB_DEBUG_LOWLVL,format,##args);}
-#define ERRMEM ERR("%s: memory reallocation failed (%s:%d).", __func__, __FILE__, __LINE__)
-#define ERRARG(arg) ERR("%s: invalid argument (%s).", __func__, arg)
-#define ERRINIT ERR("%s: libnetconf2 not initialized.", __func__)
-#define ERRINT ERR("%s: internal error (%s:%d).", __func__, __FILE__, __LINE__)
+#define ERRMEM ERR(NULL, "%s: memory reallocation failed (%s:%d).", __func__, __FILE__, __LINE__)
+#define ERRARG(arg) ERR(NULL, "%s: invalid argument (%s).", __func__, arg)
+#define ERRINIT ERR(NULL, "%s: libnetconf2 not initialized.", __func__)
+#define ERRINT ERR(NULL, "%s: internal error (%s:%d).", __func__, __FILE__, __LINE__)
#endif /* NC_LOG_PRIVATE_H_ */