Line data Source code
1 : /* SPDX-License-Identifier: LGPL-2.1+ */
2 : #pragma once
3 :
4 : #include "json.h"
5 : #include "macro.h"
6 :
7 : typedef enum OutputMode {
8 : OUTPUT_SHORT,
9 : OUTPUT_SHORT_FULL,
10 : OUTPUT_SHORT_ISO,
11 : OUTPUT_SHORT_ISO_PRECISE,
12 : OUTPUT_SHORT_PRECISE,
13 : OUTPUT_SHORT_MONOTONIC,
14 : OUTPUT_SHORT_UNIX,
15 : OUTPUT_VERBOSE,
16 : OUTPUT_EXPORT,
17 : OUTPUT_JSON,
18 : OUTPUT_JSON_PRETTY,
19 : OUTPUT_JSON_SSE,
20 : OUTPUT_JSON_SEQ,
21 : OUTPUT_CAT,
22 : OUTPUT_WITH_UNIT,
23 : _OUTPUT_MODE_MAX,
24 : _OUTPUT_MODE_INVALID = -1
25 : } OutputMode;
26 :
27 0 : static inline bool OUTPUT_MODE_IS_JSON(OutputMode m) {
28 0 : return IN_SET(m, OUTPUT_JSON, OUTPUT_JSON_PRETTY, OUTPUT_JSON_SSE, OUTPUT_JSON_SEQ);
29 : }
30 :
31 : /* The output flags definitions are shared by the logs and process tree output. Some apply to both, some only to the
32 : * logs output, others only to the process tree output. */
33 :
34 : typedef enum OutputFlags {
35 : OUTPUT_SHOW_ALL = 1 << 0,
36 : OUTPUT_FOLLOW = 1 << 1,
37 : OUTPUT_WARN_CUTOFF = 1 << 2,
38 : OUTPUT_FULL_WIDTH = 1 << 3,
39 : OUTPUT_COLOR = 1 << 4,
40 : OUTPUT_CATALOG = 1 << 5,
41 : OUTPUT_BEGIN_NEWLINE = 1 << 6,
42 : OUTPUT_UTC = 1 << 7,
43 : OUTPUT_KERNEL_THREADS = 1 << 8,
44 : OUTPUT_NO_HOSTNAME = 1 << 9,
45 : } OutputFlags;
46 :
47 : JsonFormatFlags output_mode_to_json_format_flags(OutputMode m);
48 :
49 : const char* output_mode_to_string(OutputMode m) _const_;
50 : OutputMode output_mode_from_string(const char *s) _pure_;
|