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
This commit is contained in:
Dvir Volk 2021-03-31 22:44:57 -07:00 committed by GitHub
parent 569a3f4548
commit 07f39ae47b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -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)