journalctl: add --truncate-newline option

This commit is contained in:
zhmylove
2023-06-16 09:31:47 +02:00
committed by Lennart Poettering
parent 9a109e7cd6
commit 61cecfa0d8
8 changed files with 57 additions and 14 deletions
+3
View File
@@ -524,6 +524,9 @@ static int output_short(
if (!(flags & OUTPUT_SHOW_ALL))
strip_tab_ansi(&message, &message_len, highlight_shifted);
if (flags & OUTPUT_TRUNCATE_NEWLINE)
truncate_nl_full(message, &message_len);
if (priority_len == 1 && *priority >= '0' && *priority <= '7')
p = *priority - '0';
+12 -11
View File
@@ -33,21 +33,22 @@ static inline bool OUTPUT_MODE_IS_JSON(OutputMode m) {
* logs output, others only to the process tree output. */
typedef enum OutputFlags {
OUTPUT_SHOW_ALL = 1 << 0,
OUTPUT_FULL_WIDTH = 1 << 1,
OUTPUT_COLOR = 1 << 2,
OUTPUT_SHOW_ALL = 1 << 0,
OUTPUT_FULL_WIDTH = 1 << 1,
OUTPUT_COLOR = 1 << 2,
/* Specific to log output */
OUTPUT_WARN_CUTOFF = 1 << 3,
OUTPUT_CATALOG = 1 << 4,
OUTPUT_BEGIN_NEWLINE = 1 << 5,
OUTPUT_UTC = 1 << 6,
OUTPUT_NO_HOSTNAME = 1 << 7,
OUTPUT_WARN_CUTOFF = 1 << 3,
OUTPUT_CATALOG = 1 << 4,
OUTPUT_BEGIN_NEWLINE = 1 << 5,
OUTPUT_UTC = 1 << 6,
OUTPUT_NO_HOSTNAME = 1 << 7,
OUTPUT_TRUNCATE_NEWLINE = 1 << 8,
/* Specific to process tree output */
OUTPUT_KERNEL_THREADS = 1 << 8,
OUTPUT_CGROUP_XATTRS = 1 << 9,
OUTPUT_CGROUP_ID = 1 << 10,
OUTPUT_KERNEL_THREADS = 1 << 9,
OUTPUT_CGROUP_XATTRS = 1 << 10,
OUTPUT_CGROUP_ID = 1 << 11,
} OutputFlags;
JsonFormatFlags output_mode_to_json_format_flags(OutputMode m);