}
}
-void _redisAssertPrintObject(robj *o) {
- bugReportStart();
- redisLog(REDIS_WARNING,"=== ASSERTION FAILED OBJECT CONTEXT ===");
+void redisLogObjectDebugInfo(robj *o) {
redisLog(REDIS_WARNING,"Object type: %d", o->type);
redisLog(REDIS_WARNING,"Object encoding: %d", o->encoding);
redisLog(REDIS_WARNING,"Object refcount: %d", o->refcount);
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);
+ } else if (o->type == REDIS_LIST) {
+ redisLog(REDIS_WARNING,"List length: %d", (int) listTypeLength(o));
+ } else if (o->type == REDIS_SET) {
+ redisLog(REDIS_WARNING,"Set size: %d", (int) setTypeSize(o));
+ } else if (o->type == REDIS_HASH) {
+ redisLog(REDIS_WARNING,"Hash size: %d", (int) hashTypeLength(o));
+ } else if (o->type == REDIS_ZSET) {
+ redisLog(REDIS_WARNING,"Sorted set size: %d", (int) zsetLength(o));
+ if (o->encoding == REDIS_ENCODING_SKIPLIST)
+ redisLog(REDIS_WARNING,"Skiplist level: %d", (int) ((zset*)o->ptr)->zsl->level);
}
}
+void _redisAssertPrintObject(robj *o) {
+ bugReportStart();
+ redisLog(REDIS_WARNING,"=== ASSERTION FAILED OBJECT CONTEXT ===");
+ redisLogObjectDebugInfo(o);
+}
+
void _redisAssertWithInfo(redisClient *c, robj *o, char *estr, char *file, int line) {
if (c) _redisAssertPrintClientInfo(c);
if (o) _redisAssertPrintObject(o);