Просмотр исходного кода

ncd: NCDModule: add NCDModuleInst_Backend_LogVarArg()

ambrop7 13 лет назад
Родитель
Сommit
394c33b99d
2 измененных файлов с 15 добавлено и 0 удалено
  1. 7 0
      ncd/NCDModule.c
  2. 8 0
      ncd/NCDModule.h

+ 7 - 0
ncd/NCDModule.c

@@ -298,6 +298,13 @@ void NCDModuleInst_Backend_Log (NCDModuleInst *n, int channel, int level, const
     va_end(vl);
 }
 
+void NCDModuleInst_Backend_LogVarArg (NCDModuleInst *n, int channel, int level, const char *fmt, va_list vl)
+{
+    DebugObject_Access(&n->d_obj);
+    
+    BLog_LogViaFuncVarArg(n->params->logfunc, n, channel, level, fmt, vl);
+}
+
 void NCDModuleInst_Backend_SetError (NCDModuleInst *n)
 {
     DebugObject_Access(&n->d_obj);

+ 8 - 0
ncd/NCDModule.h

@@ -30,6 +30,8 @@
 #ifndef BADVPN_NCD_NCDMODULE_H
 #define BADVPN_NCD_NCDMODULE_H
 
+#include <stdarg.h>
+
 #include <misc/debug.h>
 #include <system/BReactor.h>
 #include <base/BLog.h>
@@ -525,6 +527,12 @@ int NCDModuleInst_Backend_GetObj (NCDModuleInst *n, NCD_string_id_t name, NCDObj
  */
 void NCDModuleInst_Backend_Log (NCDModuleInst *n, int channel, int level, const char *fmt, ...);
 
+/**
+ * Like {@link NCDModuleInst_Backend_Log}, but the extra arguments are passed
+ * as a va_list. This allows creation of logging wrappers.
+ */
+void NCDModuleInst_Backend_LogVarArg (NCDModuleInst *n, int channel, int level, const char *fmt, va_list vl);
+
 /**
  * Sets the error flag for the module instance.
  * The error flag only has no effect until the backend calls