]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/output-mode.h
build(deps): bump github/codeql-action from 3.28.18 to 3.29.2
[thirdparty/systemd.git] / src / shared / output-mode.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
9bdbc2e2
LN
2#pragma once
3
69a283c5 4#include "forward.h"
766cd081 5
9bdbc2e2
LN
6typedef enum OutputMode {
7 OUTPUT_SHORT,
29a753df 8 OUTPUT_SHORT_FULL,
44bc6e1f 9 OUTPUT_SHORT_ISO,
7e563bfc 10 OUTPUT_SHORT_ISO_PRECISE,
f02d8367
ZJS
11 OUTPUT_SHORT_PRECISE,
12 OUTPUT_SHORT_MONOTONIC,
893bcd3d 13 OUTPUT_SHORT_DELTA,
bb321ed9 14 OUTPUT_SHORT_UNIX,
9bdbc2e2
LN
15 OUTPUT_VERBOSE,
16 OUTPUT_EXPORT,
17 OUTPUT_JSON,
18 OUTPUT_JSON_PRETTY,
19 OUTPUT_JSON_SSE,
8e044443 20 OUTPUT_JSON_SEQ,
9bdbc2e2 21 OUTPUT_CAT,
49805b3d 22 OUTPUT_WITH_UNIT,
9bdbc2e2 23 _OUTPUT_MODE_MAX,
2d93c20e 24 _OUTPUT_MODE_INVALID = -EINVAL,
9bdbc2e2
LN
25} OutputMode;
26
e4cbdffe
LP
27static inline bool OUTPUT_MODE_IS_JSON(OutputMode m) {
28 return IN_SET(m, OUTPUT_JSON, OUTPUT_JSON_PRETTY, OUTPUT_JSON_SSE, OUTPUT_JSON_SEQ);
29}
30
0ff308c8
LP
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
9bdbc2e2 34typedef enum OutputFlags {
61cecfa0 35 OUTPUT_SHOW_ALL = 1 << 0,
36 OUTPUT_FULL_WIDTH = 1 << 1,
37 OUTPUT_COLOR = 1 << 2,
5a5a5d29
LP
38
39 /* Specific to log output */
61cecfa0 40 OUTPUT_WARN_CUTOFF = 1 << 3,
41 OUTPUT_CATALOG = 1 << 4,
42 OUTPUT_BEGIN_NEWLINE = 1 << 5,
43 OUTPUT_UTC = 1 << 6,
44 OUTPUT_NO_HOSTNAME = 1 << 7,
45 OUTPUT_TRUNCATE_NEWLINE = 1 << 8,
5a5a5d29
LP
46
47 /* Specific to process tree output */
61cecfa0 48 OUTPUT_KERNEL_THREADS = 1 << 9,
49 OUTPUT_CGROUP_XATTRS = 1 << 10,
50 OUTPUT_CGROUP_ID = 1 << 11,
9bdbc2e2 51} OutputFlags;
766cd081 52
309a747f 53sd_json_format_flags_t output_mode_to_json_format_flags(OutputMode m);
9e964bb8 54
766cd081
LP
55const char* output_mode_to_string(OutputMode m) _const_;
56OutputMode output_mode_from_string(const char *s) _pure_;