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

Function moduleLogRaw

src/module.cpp:5230–5246  ·  view source on GitHub ↗

This is the low level function implementing both: * * RM_Log() * RM_LogIOError() * */

Source from the content-addressed store, hash-verified

5228 *
5229 */
5230void moduleLogRaw(RedisModule *module, const char *levelstr, const char *fmt, va_list ap) {
5231 char msg[LOG_MAX_LEN];
5232 size_t name_len;
5233 int level;
5234
5235 if (!strcasecmp(levelstr,"debug")) level = LL_DEBUG;
5236 else if (!strcasecmp(levelstr,"verbose")) level = LL_VERBOSE;
5237 else if (!strcasecmp(levelstr,"notice")) level = LL_NOTICE;
5238 else if (!strcasecmp(levelstr,"warning")) level = LL_WARNING;
5239 else level = LL_VERBOSE; /* Default. */
5240
5241 if (level < cserver.verbosity) return;
5242
5243 name_len = snprintf(msg, sizeof(msg),"<%s> ", module? module->name: "module");
5244 vsnprintf(msg + name_len, sizeof(msg) - name_len, fmt, ap);
5245 serverLogRaw(level,msg);
5246}
5247
5248/* Produces a log message to the standard Redis log, the format accepts
5249 * printf-alike specifiers, while level is a string describing the log

Callers 2

RM_LogFunction · 0.85
RM_LogIOErrorFunction · 0.85

Calls 1

serverLogRawFunction · 0.85

Tested by

no test coverage detected