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. */
| 1890 | * to inform the user that reply trimming can be disabled using the |
| 1891 | * debugger "maxlen" command. */ |
| 1892 | void 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 |