Skip to content

Commit c963304

Browse files
authored
Merge pull request #5723 from btriller/CFE-4126
CFE-4126: Add hardclasses for log levels notice, warning and error
2 parents 48746ab + ece3392 commit c963304

File tree

8 files changed

+222
-0
lines changed

8 files changed

+222
-0
lines changed

libpromises/generic_agent.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,6 +2682,15 @@ void GenericAgentConfigApply(EvalContext *ctx, const GenericAgentConfig *config)
26822682
// fall through
26832683
case LOG_LEVEL_INFO:
26842684
EvalContextClassPutHard(ctx, "inform_mode", "cfe_internal,source=agent");
2685+
// fall through
2686+
case LOG_LEVEL_NOTICE:
2687+
EvalContextClassPutHard(ctx, "notice_mode", "cfe_internal,source=agent");
2688+
// fall through
2689+
case LOG_LEVEL_WARNING:
2690+
EvalContextClassPutHard(ctx, "warning_mode", "cfe_internal,source=agent");
2691+
// fall through
2692+
case LOG_LEVEL_ERR:
2693+
EvalContextClassPutHard(ctx, "error_mode", "cfe_internal,source=agent");
26852694
break;
26862695
default:
26872696
break;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
bundle agent main
2+
{
3+
reports:
4+
debug_mode.opt_debug::
5+
"is debug mode";
6+
verbose_mode::
7+
"is verbose mode";
8+
inform_mode::
9+
"is inform mode";
10+
notice_mode::
11+
"is notice mode";
12+
warning_mode::
13+
"is warning mode";
14+
error_mode::
15+
"is error mode";
16+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#######################################################
2+
#
3+
# Test mode_debug hard class
4+
#
5+
#######################################################
6+
7+
body common control
8+
{
9+
inputs => { "../../default.cf.sub" };
10+
bundlesequence => { default("$(this.promise_filename)") };
11+
version => "1.0";
12+
}
13+
14+
#######################################################
15+
16+
bundle agent test
17+
{
18+
meta:
19+
"description" -> { "CFE-4126" }
20+
string => "Test mode debug class";
21+
}
22+
23+
#######################################################
24+
25+
bundle agent check
26+
{
27+
methods:
28+
"Check Agent Output"
29+
usebundle => dcs_passif_output1(".*R: is debug mode.*",
30+
"$(sys.cf_agent) --log-level debug -Kf $(this.promise_dirname)/log_mode.cf.sub",
31+
"$(this.promise_filename)");
32+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#######################################################
2+
#
3+
# Test mode_error hard class
4+
#
5+
#######################################################
6+
7+
body common control
8+
{
9+
inputs => { "../../default.cf.sub" };
10+
bundlesequence => { default("$(this.promise_filename)") };
11+
version => "1.0";
12+
}
13+
14+
#######################################################
15+
16+
bundle agent test
17+
{
18+
meta:
19+
"description" -> { "CFE-4126" }
20+
string => "Test mode error class";
21+
}
22+
23+
#######################################################
24+
25+
bundle agent check
26+
{
27+
methods:
28+
"Check Agent Output"
29+
usebundle => dcs_passif_output(".*R: is error mode.*",
30+
".*R: is (debug|verbose|inform|notice|warning) mode.*",
31+
"$(sys.cf_agent) --log-level error -Kf $(this.promise_dirname)/log_mode.cf.sub",
32+
"$(this.promise_filename)");
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#######################################################
2+
#
3+
# Test mode_inform hard class
4+
#
5+
#######################################################
6+
7+
body common control
8+
{
9+
inputs => { "../../default.cf.sub" };
10+
bundlesequence => { default("$(this.promise_filename)") };
11+
version => "1.0";
12+
}
13+
14+
#######################################################
15+
16+
bundle agent test
17+
{
18+
meta:
19+
"description" -> { "CFE-4126" }
20+
string => "Test mode inform class";
21+
}
22+
23+
#######################################################
24+
25+
bundle agent check
26+
{
27+
methods:
28+
"Check Agent Output"
29+
usebundle => dcs_passif_output(".*R: is inform mode.*",
30+
".*R: is (debug|verbose) mode.*",
31+
"$(sys.cf_agent) --log-level inform -Kf $(this.promise_dirname)/log_mode.cf.sub",
32+
"$(this.promise_filename)");
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#######################################################
2+
#
3+
# Test mode_notice hard class
4+
#
5+
#######################################################
6+
7+
body common control
8+
{
9+
inputs => { "../../default.cf.sub" };
10+
bundlesequence => { default("$(this.promise_filename)") };
11+
version => "1.0";
12+
}
13+
14+
#######################################################
15+
16+
bundle agent test
17+
{
18+
meta:
19+
"description" -> { "CFE-4126" }
20+
string => "Test mode notice class";
21+
}
22+
23+
#######################################################
24+
25+
bundle agent check
26+
{
27+
methods:
28+
"Check Agent Output"
29+
usebundle => dcs_passif_output(".*R: is notice mode.*",
30+
".*R: is (debug|verbose|inform) mode.*",
31+
"$(sys.cf_agent) --log-level notice -Kf $(this.promise_dirname)/log_mode.cf.sub",
32+
"$(this.promise_filename)");
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#######################################################
2+
#
3+
# Test mode_verbose hard class
4+
#
5+
#######################################################
6+
7+
body common control
8+
{
9+
inputs => { "../../default.cf.sub" };
10+
bundlesequence => { default("$(this.promise_filename)") };
11+
version => "1.0";
12+
}
13+
14+
#######################################################
15+
16+
bundle agent test
17+
{
18+
meta:
19+
"description" -> { "CFE-4126" }
20+
string => "Test mode verbose class";
21+
}
22+
23+
#######################################################
24+
25+
bundle agent check
26+
{
27+
methods:
28+
"Check Agent Output"
29+
usebundle => dcs_passif_output(".*R: is verbose mode.*",
30+
".*R: is debug mode.*",
31+
"$(sys.cf_agent) --log-level verbose -Kf $(this.promise_dirname)/log_mode.cf.sub",
32+
"$(this.promise_filename)");
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#######################################################
2+
#
3+
# Test mode_warning hard class
4+
#
5+
#######################################################
6+
7+
body common control
8+
{
9+
inputs => { "../../default.cf.sub" };
10+
bundlesequence => { default("$(this.promise_filename)") };
11+
version => "1.0";
12+
}
13+
14+
#######################################################
15+
16+
bundle agent test
17+
{
18+
meta:
19+
"description" -> { "CFE-4126" }
20+
string => "Test mode warning class";
21+
}
22+
23+
#######################################################
24+
25+
bundle agent check
26+
{
27+
methods:
28+
"Check Agent Output"
29+
usebundle => dcs_passif_output(".*R: is warning mode.*",
30+
".*R: is (debug|verbose|inform|notice) mode.*",
31+
"$(sys.cf_agent) --log-level warning -Kf $(this.promise_dirname)/log_mode.cf.sub",
32+
"$(this.promise_filename)");
33+
}

0 commit comments

Comments
 (0)