summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-06-04 15:53:53 +0200
committerantirez <antirez@gmail.com>2013-06-04 15:56:26 +0200
commita73da27853e56ce3d11f91d8784f6344c51807dc (patch)
tree7d6b97bfd8f3d74875b831e8deb9615a798cab22
parentfeffd5635bfdfd8eb5cac2f9fdb2475294c5ec89 (diff)
downloadredis-a73da27853e56ce3d11f91d8784f6344c51807dc.tar.gz
Binary safe dump of object content in redisLogObjectDebugInfo().
-rw-r--r--src/debug.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/debug.c b/src/debug.c
index aeb3781a8..d8898b42a 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -387,9 +387,12 @@ void redisLogObjectDebugInfo(robj *o) {
redisLog(REDIS_WARNING,"Object encoding: %d", o->encoding);
redisLog(REDIS_WARNING,"Object refcount: %d", o->refcount);
if (o->type == REDIS_STRING && o->encoding == REDIS_ENCODING_RAW) {
- redisLog(REDIS_WARNING,"Object raw string len: %d", sdslen(o->ptr));
- if (sdslen(o->ptr) < 4096)
- redisLog(REDIS_WARNING,"Object raw string content: \"%s\"", (char*)o->ptr);
+ redisLog(REDIS_WARNING,"Object raw string len: %zu", sdslen(o->ptr));
+ if (sdslen(o->ptr) < 4096) {
+ sds repr = sdscatrepr(sdsempty(),o->ptr,sdslen(o->ptr));
+ redisLog(REDIS_WARNING,"Object raw string content: %s", repr);
+ sdsfree(repr);
+ }
} else if (o->type == REDIS_LIST) {
redisLog(REDIS_WARNING,"List length: %d", (int) listTypeLength(o));
} else if (o->type == REDIS_SET) {