summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDvir Volk <dvirsky@google.com>2021-03-31 22:44:57 -0700
committerGitHub <noreply@github.com>2021-04-01 08:44:57 +0300
commit07f39ae47b1061034fe94b46a28f04c1d23c32c2 (patch)
treee494372613ab2cc658207a9ce2f2cea546e016f1
parent569a3f4548cc525aac8bd246da213eb48a17f0e1 (diff)
downloadredis-07f39ae47b1061034fe94b46a28f04c1d23c32c2.tar.gz
Added macros for RM_log logging levels (#4246)
Added macros for RM_log logging levels, to avoid typos and the need to memorize the level strings by heart
-rw-r--r--src/module.c8
-rw-r--r--src/redismodule.h6
2 files changed, 10 insertions, 4 deletions
diff --git a/src/module.c b/src/module.c
index cf2305b56..f24c0af2a 100644
--- a/src/module.c
+++ b/src/module.c
@@ -5073,10 +5073,10 @@ void moduleLogRaw(RedisModule *module, const char *levelstr, const char *fmt, va
* printf-alike specifiers, while level is a string describing the log
* level to use when emitting the log, and must be one of the following:
*
- * * "debug"
- * * "verbose"
- * * "notice"
- * * "warning"
+ * * "debug" (`REDISMODULE_LOGLEVEL_DEBUG`)
+ * * "verbose" (`REDISMODULE_LOGLEVEL_VERBOSE`)
+ * * "notice" (`REDISMODULE_LOGLEVEL_NOTICE`)
+ * * "warning" (`REDISMODULE_LOGLEVEL_WARNING`)
*
* If the specified log level is invalid, verbose is used by default.
* There is a fixed limit to the length of the log line this function is able
diff --git a/src/redismodule.h b/src/redismodule.h
index e7001ee7a..fba810de4 100644
--- a/src/redismodule.h
+++ b/src/redismodule.h
@@ -193,6 +193,12 @@ This flag should not be used directly by the module.
#define REDISMODULE_NOT_USED(V) ((void) V)
+/* Logging level strings */
+#define REDISMODULE_LOGLEVEL_DEBUG "debug"
+#define REDISMODULE_LOGLEVEL_VERBOSE "verbose"
+#define REDISMODULE_LOGLEVEL_NOTICE "notice"
+#define REDISMODULE_LOGLEVEL_WARNING "warning"
+
/* Bit flags for aux_save_triggers and the aux_load and aux_save callbacks */
#define REDISMODULE_AUX_BEFORE_RDB (1<<0)
#define REDISMODULE_AUX_AFTER_RDB (1<<1)