summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-08-01 15:37:00 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-08-01 15:37:00 +0200
commit46f7f10e4375553e6a94d7e51b604462808bbff1 (patch)
tree677c663f7c2da44c31772bb3e64b7ca63156ec46
parent5d2a114743a06f1611980ae75d704b2af5ab97ed (diff)
downloadrsyslog-46f7f10e4375553e6a94d7e51b604462808bbff1.zip
rsyslog-46f7f10e4375553e6a94d7e51b604462808bbff1.tar.gz
rsyslog-46f7f10e4375553e6a94d7e51b604462808bbff1.tar.xz
more elaborate debug logging for object deserializer
-rw-r--r--runtime/obj.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/runtime/obj.c b/runtime/obj.c
index f9afecd..fda6051 100644
--- a/runtime/obj.c
+++ b/runtime/obj.c
@@ -611,6 +611,8 @@ static rsRetVal objDeserializeProperty(var_t *pProp, strm_t *pStrm)
number_t i;
number_t iLen;
uchar c;
+ int step = 0; /* which step was successful? */
+ int64 offs;
assert(pProp != NULL);
@@ -631,13 +633,16 @@ static rsRetVal objDeserializeProperty(var_t *pProp, strm_t *pStrm)
NEXTC;
}
CHKiRet(cstrFinalize(pProp->pcsName));
+ step = 1;
/* property type */
CHKiRet(objDeserializeNumber(&i, pStrm));
pProp->varType = i;
+ step = 2;
/* size (needed for strings) */
CHKiRet(objDeserializeNumber(&iLen, pStrm));
+ step = 3;
/* we now need to deserialize the value */
switch(pProp->varType) {
@@ -654,12 +659,46 @@ static rsRetVal objDeserializeProperty(var_t *pProp, strm_t *pStrm)
dbgprintf("invalid VARTYPE %d\n", pProp->varType);
break;
}
+ step = 4;
/* we should now be at the end of the line. So the next char must be \n */
NEXTC;
if(c != '\n') ABORT_FINALIZE(RS_RET_INVALID_PROPFRAME);
finalize_it:
+ if(Debug && iRet != RS_RET_OK) {
+ strm.GetCurrOffset(pStrm, &offs);
+ if(step == 0) {
+ dbgprintf("error %d deserializing property name, offset %lld, step %d\n",
+ iRet, offs, step);
+ }
+ if(step >= 1) {
+ dbgprintf("error property name: '%s'\n", rsCStrGetSzStrNoNULL(pProp->pcsName));
+ }
+ if(step >= 2) {
+ dbgprintf("error var type: '%d'\n", pProp->varType);
+ }
+ if(step >= 3) {
+ dbgprintf("error len: '%d'\n", (int) iLen);
+ }
+ if(step >= 4) {
+ switch(pProp->varType) {
+ case VARTYPE_STR:
+ dbgprintf("error data string: '%s'\n",
+ rsCStrGetSzStrNoNULL(pProp->val.pStr));
+ break;
+ case VARTYPE_NUMBER:
+ dbgprintf("error number: %d\n", (int) pProp->val.num);
+ break;
+ case VARTYPE_SYSLOGTIME:
+ dbgprintf("syslog time was successfully parsed (but "
+ "is not displayed\n");
+ break;
+ default:
+ break;
+ }
+ }
+ }
RETiRet;
}