]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/logs-show.h
Merge nss-myhostname
[thirdparty/systemd.git] / src / shared / logs-show.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6 This file is part of systemd.
7
8 Copyright 2012 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 #include <stdbool.h>
25
26 #include <systemd/sd-journal.h>
27
28 #include "util.h"
29
30 typedef enum OutputMode {
31 OUTPUT_SHORT,
32 OUTPUT_SHORT_MONOTONIC,
33 OUTPUT_VERBOSE,
34 OUTPUT_EXPORT,
35 OUTPUT_JSON,
36 OUTPUT_JSON_PRETTY,
37 OUTPUT_JSON_SSE,
38 OUTPUT_CAT,
39 _OUTPUT_MODE_MAX,
40 _OUTPUT_MODE_INVALID = -1
41 } OutputMode;
42
43 typedef enum OutputFlags {
44 OUTPUT_SHOW_ALL = 1 << 0,
45 OUTPUT_FOLLOW = 1 << 1,
46 OUTPUT_WARN_CUTOFF = 1 << 2,
47 OUTPUT_FULL_WIDTH = 1 << 3,
48 OUTPUT_COLOR = 1 << 4,
49 OUTPUT_CATALOG = 1 << 5
50 } OutputFlags;
51
52 int output_journal(
53 FILE *f,
54 sd_journal *j,
55 OutputMode mode,
56 unsigned n_columns,
57 OutputFlags flags);
58
59 int show_journal_by_unit(
60 FILE *f,
61 const char *unit,
62 OutputMode mode,
63 unsigned n_columns,
64 usec_t not_before,
65 unsigned how_many,
66 OutputFlags flags);
67
68 void json_escape(
69 FILE *f,
70 const char* p,
71 size_t l,
72 OutputFlags flags);
73
74 const char* output_mode_to_string(OutputMode m);
75 OutputMode output_mode_from_string(const char *s);