state++;
}
}
- else lprintf(1, "don't know how to handle message header[%s]\n", ChrPtr(HdrToken));
+ else LogError(Target,
+ __FUNCTION__,
+ "don't know how to handle message header[%s]\n",
+ ChrPtr(HdrToken));
break;
case 1:/* Message Mime Header */
if (StrLength(Buf) == 0) {
Type,
ChrPtr(Error));
}
+/*
if (Target == NULL)
return;
+*/
WCC = WC;
Header = NewStrBuf();
if (TP->Tokens != NULL)
}
+
+
+void LogError (StrBuf *Target, const char *Type, const char *Format, ...)
+{
+ wcsession *WCC;
+ StrBuf *Header;
+ StrBuf *Error;
+ StrBuf *Info;
+ va_list arg_ptr;
+
+ Info = NewStrBuf();
+ Error = NewStrBuf();
+
+ va_start(arg_ptr, Format);
+ StrBufVAppendPrintf(Error, Format, arg_ptr);
+ va_end(arg_ptr);
+
+ lprintf(1, ChrPtr(Error));
+
+ WCC = WC;
+ Header = NewStrBuf();
+
+
+ SerializeJson(Header, WildFireException(Type, strlen(Type),
+ 0,
+ Info,
+ 1), 1);
+ WildFireSerializePayload(Header, WCC->HBuf, &WCC->nWildfireHeaders, NULL);
+
+ FreeStrBuf(&Header);
+ FreeStrBuf(&Info);
+ FreeStrBuf(&Error);
+/*
+ if (dbg_bactrace_template_errors)
+ wc_backtrace();
+*/
+}
+
+
void RegisterNS(const char *NSName,
long len,
int nMinArgs,
-
+\
extern HashList *Conditionals;
extern HashList *GlobalNS;
extern HashList *Iterators;
WCTemplputParams *TP,
const char *Format, ...)__attribute__((__format__(__printf__,5,6)));
+
+/**
+ * \Brief log an error while in global context; print it to Wildfire / Target
+ * \param Target your Target Buffer to print the error message next to the log
+ * \param Type What sort of thing are we talking about? Tokens? Conditionals?
+ * \param Format for the custom error message
+ */
+void LogError (StrBuf *Target, const char *Type, const char *Format, ...);
+
/**
* \Brief get the actual value of a token parameter
* in your tmplputs or conditionals use this function to access parameters that can also be