output-mode: add new helper OUTPUT_MODE_IS_JSON()

Just a pretty way to determine whether the selected output mode is a
JSON output mode.
This commit is contained in:
Lennart Poettering 2018-12-03 20:43:07 +01:00
parent 9e964bb8e4
commit e4cbdffe28
1 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,10 @@ typedef enum OutputMode {
_OUTPUT_MODE_INVALID = -1
} OutputMode;
static inline bool OUTPUT_MODE_IS_JSON(OutputMode m) {
return IN_SET(m, OUTPUT_JSON, OUTPUT_JSON_PRETTY, OUTPUT_JSON_SSE, OUTPUT_JSON_SEQ);
}
/* The output flags definitions are shared by the logs and process tree output. Some apply to both, some only to the
* logs output, others only to the process tree output. */