MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / sdsCatColorizedLdbReply

Function sdsCatColorizedLdbReply

src/redis-cli.c:927–941  ·  view source on GitHub ↗

Colorize Lua debugger status replies according to the prefix they * have. */

Source from the content-addressed store, hash-verified

925/* Colorize Lua debugger status replies according to the prefix they
926 * have. */
927sds sdsCatColorizedLdbReply(sds o, char *s, size_t len) {
928 char *color = "white";
929
930 if (strstr(s,"<debug>")) color = "bold";
931 if (strstr(s,"<redis>")) color = "green";
932 if (strstr(s,"<reply>")) color = "cyan";
933 if (strstr(s,"<error>")) color = "red";
934 if (strstr(s,"<hint>")) color = "bold";
935 if (strstr(s,"<value>") || strstr(s,"<retval>")) color = "magenta";
936 if (len > 4 && isdigit(s[3])) {
937 if (s[1] == '>') color = "yellow"; /* Current line. */
938 else if (s[2] == '#') color = "bold"; /* Break point. */
939 }
940 return sdscatcolor(o,s,len,color);
941}
942
943static sds cliFormatReplyRaw(redisReply *r) {
944 sds out = sdsempty(), tmp;

Callers 1

cliFormatReplyRawFunction · 0.85

Calls 1

sdscatcolorFunction · 0.85

Tested by

no test coverage detected