MINOR: add severity information to cli feedback messages
diff --git a/src/cli.c b/src/cli.c
index 266bade..1695dbe 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -385,6 +385,7 @@
struct stream *s = si_strm(si);
if ((strm_li(s)->bind_conf->level & ACCESS_LVL_MASK) < level) {
+ appctx->ctx.cli.severity = LOG_ERR;
appctx->ctx.cli.msg = stats_permission_denied_msg;
appctx->st0 = CLI_ST_PRINT;
return 0;
@@ -610,10 +611,14 @@
else if (strcmp(trash.str, "help") == 0 ||
!cli_parse_request(appctx, trash.str)) {
cli_gen_usage_msg();
- if (dynamic_usage_msg)
+ if (dynamic_usage_msg) {
+ appctx->ctx.cli.severity = LOG_INFO;
appctx->ctx.cli.msg = dynamic_usage_msg;
- else
+ }
+ else {
+ appctx->ctx.cli.severity = LOG_INFO;
appctx->ctx.cli.msg = stats_sock_usage_msg;
+ }
appctx->st0 = CLI_ST_PRINT;
}
/* NB: stats_sock_parse_request() may have put
@@ -626,10 +631,14 @@
* prompt and find help.
*/
cli_gen_usage_msg();
- if (dynamic_usage_msg)
+ if (dynamic_usage_msg) {
+ appctx->ctx.cli.severity = LOG_INFO;
appctx->ctx.cli.msg = dynamic_usage_msg;
- else
+ }
+ else {
+ appctx->ctx.cli.severity = LOG_INFO;
appctx->ctx.cli.msg = stats_sock_usage_msg;
+ }
appctx->st0 = CLI_ST_PRINT;
}
@@ -996,6 +1005,7 @@
break;
}
if (!*var) {
+ appctx->ctx.cli.severity = LOG_ERR;
appctx->ctx.cli.msg = "Variable not found\n";
appctx->st0 = CLI_ST_PRINT;
return 1;
@@ -1035,6 +1045,7 @@
const char *res;
if (!*args[3]) {
+ appctx->ctx.cli.severity = LOG_ERR;
appctx->ctx.cli.msg = "Expects an integer value.\n";
appctx->st0 = CLI_ST_PRINT;
return 1;
@@ -1042,6 +1053,7 @@
res = parse_time_err(args[3], &timeout, TIME_UNIT_S);
if (res || timeout < 1) {
+ appctx->ctx.cli.severity = LOG_ERR;
appctx->ctx.cli.msg = "Invalid timeout value.\n";
appctx->st0 = CLI_ST_PRINT;
return 1;
@@ -1052,6 +1064,7 @@
return 1;
}
else {
+ appctx->ctx.cli.severity = LOG_ERR;
appctx->ctx.cli.msg = "'set timeout' only supports 'cli'.\n";
appctx->st0 = CLI_ST_PRINT;
return 1;
@@ -1067,6 +1080,7 @@
return 1;
if (!*args[3]) {
+ appctx->ctx.cli.severity = LOG_ERR;
appctx->ctx.cli.msg = "Expects an integer value.\n";
appctx->st0 = CLI_ST_PRINT;
return 1;
@@ -1074,6 +1088,7 @@
v = atoi(args[3]);
if (v > global.hardmaxconn) {
+ appctx->ctx.cli.severity = LOG_ERR;
appctx->ctx.cli.msg = "Value out of range.\n";
appctx->st0 = CLI_ST_PRINT;
return 1;
@@ -1149,6 +1164,7 @@
mul = 1024;
}
else {
+ appctx->ctx.cli.severity = LOG_ERR;
appctx->ctx.cli.msg =
"'set rate-limit' only supports :\n"
" - 'connections global' to set the per-process maximum connection rate\n"
@@ -1162,6 +1178,7 @@
}
if (!*args[4]) {
+ appctx->ctx.cli.severity = LOG_ERR;
appctx->ctx.cli.msg = "Expects an integer value.\n";
appctx->st0 = CLI_ST_PRINT;
return 1;
@@ -1169,6 +1186,7 @@
v = atoi(args[4]);
if (v < 0) {
+ appctx->ctx.cli.severity = LOG_ERR;
appctx->ctx.cli.msg = "Value out of range.\n";
appctx->st0 = CLI_ST_PRINT;
return 1;