From: Lennart Poettering Date: Mon, 3 Dec 2018 19:43:07 +0000 (+0100) Subject: output-mode: add new helper OUTPUT_MODE_IS_JSON() X-Git-Tag: v240~143^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e4cbdffe282ab9b3bb346a963726484f1ed71b08;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/shared/output-mode.h b/src/shared/output-mode.h index a3be8d668eb..00b60320567 100644 --- a/src/shared/output-mode.h +++ b/src/shared/output-mode.h @@ -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. */