mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
logs: Adapt interface in log-show.c (show_journal_by_unit)
Convert more flag arguments into one flag variable.
This commit is contained in:
parent
25277cd7fb
commit
085d71209b
@ -553,15 +553,14 @@ int show_journal_by_unit(
|
|||||||
unsigned n_columns,
|
unsigned n_columns,
|
||||||
usec_t not_before,
|
usec_t not_before,
|
||||||
unsigned how_many,
|
unsigned how_many,
|
||||||
bool show_all,
|
OutputFlags flags) {
|
||||||
bool follow,
|
|
||||||
bool warn_cutoff) {
|
|
||||||
|
|
||||||
char *m = NULL;
|
char *m = NULL;
|
||||||
sd_journal *j = NULL;
|
sd_journal *j = NULL;
|
||||||
int r;
|
int r;
|
||||||
unsigned line = 0;
|
unsigned line = 0;
|
||||||
bool need_seek = false;
|
bool need_seek = false;
|
||||||
|
int warn_cutoff = flags & OUTPUT_WARN_CUTOFF;
|
||||||
|
|
||||||
assert(mode >= 0);
|
assert(mode >= 0);
|
||||||
assert(mode < _OUTPUT_MODE_MAX);
|
assert(mode < _OUTPUT_MODE_MAX);
|
||||||
@ -633,8 +632,7 @@ int show_journal_by_unit(
|
|||||||
|
|
||||||
line ++;
|
line ++;
|
||||||
|
|
||||||
r = output_journal(j, mode, line, n_columns,
|
r = output_journal(j, mode, line, n_columns, flags);
|
||||||
show_all ? OUTPUT_SHOW_ALL : 0);
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
@ -659,7 +657,7 @@ int show_journal_by_unit(
|
|||||||
warn_cutoff = false;
|
warn_cutoff = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!follow)
|
if (!(flags & OUTPUT_FOLLOW))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
r = sd_journal_wait(j, (usec_t) -1);
|
r = sd_journal_wait(j, (usec_t) -1);
|
||||||
|
@ -42,6 +42,8 @@ typedef enum OutputMode {
|
|||||||
typedef enum OutputFlags {
|
typedef enum OutputFlags {
|
||||||
OUTPUT_SHOW_ALL = 1 << 0,
|
OUTPUT_SHOW_ALL = 1 << 0,
|
||||||
OUTPUT_MONOTONIC_MODE = 1 << 1,
|
OUTPUT_MONOTONIC_MODE = 1 << 1,
|
||||||
|
OUTPUT_FOLLOW = 1 << 2,
|
||||||
|
OUTPUT_WARN_CUTOFF = 1 << 3,
|
||||||
} OutputFlags;
|
} OutputFlags;
|
||||||
|
|
||||||
int output_journal(sd_journal *j, OutputMode mode, unsigned line,
|
int output_journal(sd_journal *j, OutputMode mode, unsigned line,
|
||||||
@ -53,9 +55,7 @@ int show_journal_by_unit(
|
|||||||
unsigned n_columns,
|
unsigned n_columns,
|
||||||
usec_t not_before,
|
usec_t not_before,
|
||||||
unsigned how_many,
|
unsigned how_many,
|
||||||
bool show_all,
|
OutputFlags flags);
|
||||||
bool follow,
|
|
||||||
bool warn_cutoff);
|
|
||||||
|
|
||||||
const char* output_mode_to_string(OutputMode m);
|
const char* output_mode_to_string(OutputMode m);
|
||||||
OutputMode output_mode_from_string(const char *s);
|
OutputMode output_mode_from_string(const char *s);
|
||||||
|
@ -2592,8 +2592,13 @@ static void print_status_info(UnitStatusInfo *i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i->id && arg_transport != TRANSPORT_SSH) {
|
if (i->id && arg_transport != TRANSPORT_SSH) {
|
||||||
|
int flags = (arg_lines*OUTPUT_SHOW_ALL |
|
||||||
|
arg_follow*OUTPUT_FOLLOW |
|
||||||
|
!arg_quiet*OUTPUT_WARN_CUTOFF);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
show_journal_by_unit(i->id, arg_output, 0, i->inactive_exit_timestamp_monotonic, arg_lines, arg_all, arg_follow, !arg_quiet);
|
show_journal_by_unit(i->id, arg_output, 0,
|
||||||
|
i->inactive_exit_timestamp_monotonic,
|
||||||
|
arg_lines, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i->need_daemon_reload)
|
if (i->need_daemon_reload)
|
||||||
|
Loading…
Reference in New Issue
Block a user