This is the low level function implementing both: * * RM_Log() * RM_LogIOError() * */
| 5119 | * |
| 5120 | */ |
| 5121 | void moduleLogRaw(RedisModule *module, const char *levelstr, const char *fmt, va_list ap) { |
| 5122 | char msg[LOG_MAX_LEN]; |
| 5123 | size_t name_len; |
| 5124 | int level; |
| 5125 | |
| 5126 | if (!strcasecmp(levelstr,"debug")) level = LL_DEBUG; |
| 5127 | else if (!strcasecmp(levelstr,"verbose")) level = LL_VERBOSE; |
| 5128 | else if (!strcasecmp(levelstr,"notice")) level = LL_NOTICE; |
| 5129 | else if (!strcasecmp(levelstr,"warning")) level = LL_WARNING; |
| 5130 | else level = LL_VERBOSE; /* Default. */ |
| 5131 | |
| 5132 | if (level < server.verbosity) return; |
| 5133 | |
| 5134 | name_len = snprintf(msg, sizeof(msg),"<%s> ", module? module->name: "module"); |
| 5135 | vsnprintf(msg + name_len, sizeof(msg) - name_len, fmt, ap); |
| 5136 | serverLogRaw(level,msg); |
| 5137 | } |
| 5138 | |
| 5139 | /* Produces a log message to the standard Redis log, the format accepts |
| 5140 | * printf-alike specifiers, while level is a string describing the log |
no test coverage detected