mirror of
http://github.com/valkey-io/valkey
synced 2024-11-22 00:52:38 +00:00
Sync the new loglevel nothing to sentinel (#12223)
We add a new loglevel 'nothing' to disable logging in #12133. This PR syncs that config change to sentinel. Because in #11214 we support modifying loglevel in runtime. Although I think sentinel doesn't need this nothing config, it's better to be consistent.
This commit is contained in:
parent
ec5721d6ca
commit
d0994c5bca
@ -25,6 +25,7 @@ pidfile /var/run/redis-sentinel.pid
|
||||
# verbose (many rarely useful info, but not a mess like the debug level)
|
||||
# notice (moderately verbose, what you want in production probably)
|
||||
# warning (only very important / critical messages are logged)
|
||||
# nothing (nothing is logged)
|
||||
loglevel notice
|
||||
|
||||
# Specify the log file name. Also the empty string can be used to force
|
||||
|
@ -3192,6 +3192,7 @@ const char* getLogLevel(void) {
|
||||
case LL_VERBOSE: return "verbose";
|
||||
case LL_NOTICE: return "notice";
|
||||
case LL_WARNING: return "warning";
|
||||
case LL_NOTHING: return "nothing";
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
@ -3252,7 +3253,8 @@ void sentinelConfigSetCommand(client *c) {
|
||||
numval < 0 || numval > 65535) goto badfmt;
|
||||
} else if (!strcasecmp(option, "loglevel")) {
|
||||
if (!(!strcasecmp(val->ptr, "debug") || !strcasecmp(val->ptr, "verbose") ||
|
||||
!strcasecmp(val->ptr, "notice") || !strcasecmp(val->ptr, "warning"))) goto badfmt;
|
||||
!strcasecmp(val->ptr, "notice") || !strcasecmp(val->ptr, "warning") ||
|
||||
!strcasecmp(val->ptr, "nothing"))) goto badfmt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3270,6 +3272,8 @@ void sentinelConfigSetCommand(client *c) {
|
||||
server.verbosity = LL_NOTICE;
|
||||
else if (!strcasecmp(val->ptr, "warning"))
|
||||
server.verbosity = LL_WARNING;
|
||||
else if (!strcasecmp(val->ptr, "nothing"))
|
||||
server.verbosity = LL_NOTHING;
|
||||
} else if (!strcasecmp(option, "resolve-hostnames") && moreargs > 0) {
|
||||
val = c->argv[++i];
|
||||
numval = yesnotoi(val->ptr);
|
||||
|
@ -41,7 +41,10 @@ test "New master [join $addr {:}] role matches" {
|
||||
test "Update log level" {
|
||||
set current_loglevel [S 0 SENTINEL CONFIG GET loglevel]
|
||||
assert {[lindex $current_loglevel 1] == {notice}}
|
||||
S 0 SENTINEL CONFIG SET loglevel warning
|
||||
|
||||
foreach {loglevel} {debug verbose notice warning nothing} {
|
||||
S 0 SENTINEL CONFIG SET loglevel $loglevel
|
||||
set updated_loglevel [S 0 SENTINEL CONFIG GET loglevel]
|
||||
assert {[lindex $updated_loglevel 1] == {warning}}
|
||||
assert {[lindex $updated_loglevel 1] == $loglevel}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user