]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
output-mode: add new helper OUTPUT_MODE_IS_JSON()
authorLennart Poettering <lennart@poettering.net>
Mon, 3 Dec 2018 19:43:07 +0000 (20:43 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 3 Dec 2018 21:42:38 +0000 (22:42 +0100)
Just a pretty way to determine whether the selected output mode is a
JSON output mode.

src/shared/output-mode.h

index a3be8d668eb5333d276107131bd4f7476700ff3f..00b603205671902e5c93ec95b65f82ab1727898f 100644 (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. */