mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-24 04:51:27 +00:00
Merge branch 'master' into inex/service-settings
This commit is contained in:
commit
c1d54c149d
|
@ -66,7 +66,7 @@
|
|||
SCRIPT=$(cat <<EOF
|
||||
start_all()
|
||||
machine.succeed("ln -sf $NIXOS_VM_SHARED_DIR_GUEST -T ${vmtest-src-dir} >&2")
|
||||
machine.succeed("cd ${vmtest-src-dir} && coverage run -m pytest -v $@ >&2")
|
||||
machine.succeed("cd ${vmtest-src-dir} && coverage run -m pytest $@ >&2")
|
||||
machine.succeed("cd ${vmtest-src-dir} && coverage report >&2")
|
||||
EOF
|
||||
)
|
||||
|
|
|
@ -75,6 +75,10 @@ class Logs:
|
|||
up_cursor: str | None = None,
|
||||
# All entries returned will be greater than this cursor. Sets lower bound on results.
|
||||
down_cursor: str | None = None,
|
||||
# All entries will be from a specific systemd slice
|
||||
filterBySlice: str | None = None,
|
||||
# All entries will be from a specific systemd unit
|
||||
filterByUnit: str | None = None,
|
||||
) -> PaginatedEntries:
|
||||
if limit > 50:
|
||||
raise Exception("You can't fetch more than 50 entries via single request.")
|
||||
|
@ -82,7 +86,7 @@ class Logs:
|
|||
list(
|
||||
map(
|
||||
lambda x: LogEntry(x),
|
||||
get_paginated_logs(limit, up_cursor, down_cursor),
|
||||
get_paginated_logs(limit, up_cursor, down_cursor, filterBySlice, filterByUnit),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -24,9 +24,18 @@ def get_paginated_logs(
|
|||
up_cursor: str | None = None,
|
||||
# All entries returned will be greater than this cursor. Sets lower bound on results.
|
||||
down_cursor: str | None = None,
|
||||
# All entries will be from a specific systemd slice
|
||||
filterBySlice: str | None = None,
|
||||
# All entries will be from a specific systemd unit
|
||||
filterByUnit: str | None = None,
|
||||
):
|
||||
j = journal.Reader()
|
||||
|
||||
if filterBySlice:
|
||||
j.add_match("_SYSTEMD_SLICE=" + filterBySlice)
|
||||
if filterByUnit:
|
||||
j.add_match("_SYSTEMD_UNIT=" + filterByUnit)
|
||||
|
||||
if up_cursor is None and down_cursor is None:
|
||||
j.seek_tail()
|
||||
|
||||
|
|
Loading…
Reference in a new issue