diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-30 22:34:42 +0200 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-30 22:34:42 +0200 |
commit | f413ac38e30e606beda4ef7f6bf1db40b49682d3 (patch) | |
tree | 13fba7932b2cf22f7da5f5a6b48b02e35a9f4013 /lib/output.c | |
parent | f84f614f219b395810e4ca35d5eb5f5a8d2f1d5b (diff) | |
download | monitoring-plugins-f413ac38e30e606beda4ef7f6bf1db40b49682d3.tar.gz |
Add selectable level of detail for output
Diffstat (limited to 'lib/output.c')
-rw-r--r-- | lib/output.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/output.c b/lib/output.c index 01e50770..c408a2f5 100644 --- a/lib/output.c +++ b/lib/output.c | |||
@@ -253,7 +253,9 @@ char *mp_fmt_output(mp_check check) { | |||
253 | mp_subcheck_list *subchecks = check.subchecks; | 253 | mp_subcheck_list *subchecks = check.subchecks; |
254 | 254 | ||
255 | while (subchecks != NULL) { | 255 | while (subchecks != NULL) { |
256 | asprintf(&result, "%s\n%s", result, fmt_subcheck_output(MP_FORMAT_MULTI_LINE, subchecks->subcheck, 1)); | 256 | if (level_of_detail == MP_DETAIL_ALL || mp_compute_subcheck_state(subchecks->subcheck) != STATE_OK) { |
257 | asprintf(&result, "%s\n%s", result, fmt_subcheck_output(MP_FORMAT_MULTI_LINE, subchecks->subcheck, 1)); | ||
258 | } | ||
257 | subchecks = subchecks->next; | 259 | subchecks = subchecks->next; |
258 | } | 260 | } |
259 | 261 | ||
@@ -545,3 +547,7 @@ parsed_output_format mp_parse_output_format(char *format_string) { | |||
545 | void mp_set_format(mp_output_format format) { output_format = format; } | 547 | void mp_set_format(mp_output_format format) { output_format = format; } |
546 | 548 | ||
547 | mp_output_format mp_get_format(void) { return output_format; } | 549 | mp_output_format mp_get_format(void) { return output_format; } |
550 | |||
551 | void mp_set_level_of_detail(mp_output_detail_level level) { level_of_detail = level; } | ||
552 | |||
553 | mp_output_detail_level mp_get_level_of_detail(void) { return level_of_detail; } | ||