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

Function ldbSendLogs

src/scripting.cpp:1933–1950  ·  view source on GitHub ↗

Send ldb.logs to the debugging client as a multi-bulk reply * consisting of simple strings. Log entries which include newlines have them * replaced with spaces. The entries sent are also consumed. */

Source from the content-addressed store, hash-verified

1931 * consisting of simple strings. Log entries which include newlines have them
1932 * replaced with spaces. The entries sent are also consumed. */
1933void ldbSendLogs(void) {
1934 sds proto = sdsempty();
1935 proto = sdscatfmt(proto,"*%i\r\n", (int)listLength(ldb.logs));
1936 while(listLength(ldb.logs)) {
1937 listNode *ln = listFirst(ldb.logs);
1938 proto = sdscatlen(proto,"+",1);
1939 sdsmapchars((sds)ln->value,"\r\n"," ",2);
1940 proto = sdscatsds(proto,(sds)ln->value);
1941 proto = sdscatlen(proto,"\r\n",2);
1942 listDelNode(ldb.logs,ln);
1943 }
1944 if (connWrite(ldb.conn,proto,sdslen(proto)) == -1) {
1945 /* Avoid warning. We don't check the return value of write()
1946 * since the next read() will catch the I/O error and will
1947 * close the debugging session. */
1948 }
1949 sdsfree(proto);
1950}
1951
1952/* Start a debugging session before calling EVAL implementation.
1953 * The technique we use is to capture the client socket file descriptor,

Callers 3

ldbEndSessionFunction · 0.85
ldbReplFunction · 0.85
luaLdbLineHookFunction · 0.85

Calls 9

sdsemptyFunction · 0.85
sdscatfmtFunction · 0.85
sdscatlenFunction · 0.85
sdsmapcharsFunction · 0.85
sdscatsdsFunction · 0.85
listDelNodeFunction · 0.85
connWriteFunction · 0.85
sdslenFunction · 0.85
sdsfreeFunction · 0.85

Tested by

no test coverage detected