Fix debug/log-viewer for non-nixos systems + show more initial lines

This commit is contained in:
Ole Jørgen Brønner
2018-06-26 21:46:33 +02:00
parent 5f75e9376e
commit 6a1d4dcbc5
+10 -3
View File
@@ -1,5 +1,6 @@
#!/usr/bin/env zsh
# Ref: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1
function skip-crap {
local crap_start=".*: Object [^ ]+ \(.*\), has been already finalized. Impossible to \w* any property \w* it.*"
@@ -45,14 +46,20 @@ function date-on-separate-line {
stdbuf -oL sed -e 's|\]:|]:\n |'
}
# We use non-breaking space to encode newlines in multiline messages
function decode-multiline-message {
stdbuf -oL sed -e 's| |\n |g'
}
# We use non-breaking space to encode newlines in multiline messages
function gnome-shell-exe-path {
if uname -a | grep --silent "NixOS"; then
echo $(dirname =gnome-shell(:A))/.gnome-shell-wrapped
else
echo =gnome-shell
fi
}
journalctl --follow \
$(dirname =gnome-shell(:A))/.gnome-shell-wrapped \
journalctl --follow --lines 400 $(gnome-shell-exe-path) \
| skip-crap \
| date-on-separate-line \
| decode-multiline-message