json_util: add debug logs to spdk_json_decode_object function

It is helpful to see what went wrong during decoding.

Change-Id: Ia26d3ea6e97823966840e688eaf9264dfef120a8
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/436194
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Pawel Wodkowski 2018-12-05 12:55:07 +01:00 committed by Jim Harris
parent 122a776326
commit 40f70de06e

View File

@ -331,10 +331,12 @@ spdk_json_decode_object(const struct spdk_json_val *values,
if (seen[decidx]) {
/* duplicate field name */
invalid = true;
SPDK_JSON_DEBUG("Duplicate key '%s'\n", dec->name);
} else {
seen[decidx] = true;
if (dec->decode_func(v, field)) {
invalid = true;
SPDK_JSON_DEBUG("Decoder failed to decode key '%s'\n", dec->name);
/* keep going to fill out any other valid keys */
}
}
@ -344,6 +346,7 @@ spdk_json_decode_object(const struct spdk_json_val *values,
if (!found) {
invalid = true;
SPDK_JSON_DEBUG("Decoder not found for key '%.*s'\n", name->len, (char *)name->start);
}
i += 1 + spdk_json_val_len(v);