diff options
| author | Thorsten Töpper <atsutane@freethoughts.de> | 2025-08-07 23:33:31 +0200 |
|---|---|---|
| committer | Thorsten Töpper <atsutane@freethoughts.de> | 2025-08-07 23:34:37 +0200 |
| commit | 371468655c0adbedbe5148fddd2dacaae9eac6e0 (patch) | |
| tree | dbb63532c8be17d10eef28be2866907db352d305 /include | |
| parent | afdf29bc31744905e535c04d7f4804652e64e045 (diff) | |
| download | dir_monitor-371468655c0adbedbe5148fddd2dacaae9eac6e0.tar.gz dir_monitor-371468655c0adbedbe5148fddd2dacaae9eac6e0.tar.bz2 | |
options/output: add --quiet to suppress error/warning messages
As the LOGERR macro is modified this option will also suppress debug
messages in case the executable was built with -DDEBUGBUILD.
Diffstat (limited to 'include')
| -rw-r--r-- | include/options.h | 1 | ||||
| -rw-r--r-- | include/output.h | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/options.h b/include/options.h index cae9aa0..c92dbdf 100644 --- a/include/options.h +++ b/include/options.h @@ -30,6 +30,7 @@ extern bool option_sort_reverse_order; extern enum esort_type option_sort_type; extern bool option_print_boxed_table; extern bool option_print_header; +extern bool option_quiet; extern bool option_resolve_symlinks; extern bool option_show_hidden_entries; extern bool option_timestamp_long; diff --git a/include/output.h b/include/output.h index 53f0869..38546aa 100644 --- a/include/output.h +++ b/include/output.h @@ -8,10 +8,11 @@ #define OUTPUT_H #include <stdio.h> +#include "options.h" #include "data_management.h" -#define LOGERR(...) {fprintf(stderr, "[%s:%d] %s: ", __FILE__, __LINE__, __func__); fprintf(stderr, __VA_ARGS__);} +#define LOGERR(...) {if (!option_quiet){ fprintf(stderr, "[%s:%d] %s: ", __FILE__, __LINE__, __func__); fprintf(stderr, __VA_ARGS__); }} #ifdef DEBUGBUILD #define DBGTRC(...) LOGERR(__VA_ARGS__) |
