MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ldbLogWithMaxLen

Function ldbLogWithMaxLen

app/redis-6.2.6/src/scripting.c:1892–1905  ·  view source on GitHub ↗

A version of ldbLog() which prevents producing logs greater than * ldb.maxlen. The first time the limit is reached a hint is generated * to inform the user that reply trimming can be disabled using the * debugger "maxlen" command. */

Source from the content-addressed store, hash-verified

1890 * to inform the user that reply trimming can be disabled using the
1891 * debugger "maxlen" command. */
1892void ldbLogWithMaxLen(sds entry) {
1893 int trimmed = 0;
1894 if (ldb.maxlen && sdslen(entry) > ldb.maxlen) {
1895 sdsrange(entry,0,ldb.maxlen-1);
1896 entry = sdscatlen(entry," ...",4);
1897 trimmed = 1;
1898 }
1899 ldbLog(entry);
1900 if (trimmed && ldb.maxlen_hint_sent == 0) {
1901 ldb.maxlen_hint_sent = 1;
1902 ldbLog(sdsnew(
1903 "<hint> The above reply was trimmed. Use 'maxlen 0' to disable trimming."));
1904 }
1905}
1906
1907/* Send ldb.logs to the debugging client as a multi-bulk reply
1908 * consisting of simple strings. Log entries which include newlines have them

Callers 2

ldbLogStackValueFunction · 0.85
ldbLogRedisReplyFunction · 0.85

Calls 5

sdslenFunction · 0.85
sdsrangeFunction · 0.85
sdscatlenFunction · 0.85
ldbLogFunction · 0.85
sdsnewFunction · 0.85

Tested by

no test coverage detected