# HG changeset patch # User Pascal Bellard # Date 1421603941 -3600 # Node ID 7475f4b95a7b4eb8d64764d7177d377b8e86cac5 # Parent 197057e85b1a5f9a6f04e836eeecccb4f418215e boot.cgi: display log files in tabs diff -r 197057e85b1a -r 7475f4b95a7b boot.cgi --- a/boot.cgi Sun Jan 18 14:23:23 2015 +0100 +++ b/boot.cgi Sun Jan 18 18:59:01 2015 +0100 @@ -13,37 +13,45 @@ TITLE=$(gettext 'TazPanel - Boot') +loghead() +{ + tail -n 40 $1 | htmlize + [ $(wc -l < $1) -gt 40 ] && cat <$(gettext 'Show more...') +EOT +} + # # Commands # case " $(GET) " in *\ log\ *) + unset actboot actslim actxlog actkernel + case "$(GET log)" in + boot) actboot=' class="active"' + output="$(filter_taztools_msgs < /var/log/boot.log)" + ;; + slim) actslim=' class="active"' + output="$(loghead /var/log/slim.log)" ;; + xlog) actxlog=' class="active"' + output="$(loghead /var/log/Xorg.0.log)" ;; + *) actkernel=' class="active"' + output="$(syntax_highlighter kernel < /var/log/dmesg.log)" + esac xhtml_header cat << EOT

$(gettext 'Boot log files')

-
- - $(gettext 'Kernel messages') - $(gettext 'Boot scripts') - $(gettext 'X server') -
- -

$(gettext 'Kernel messages')

- -
$(cat /var/log/dmesg.log | syntax_highlighter kernel)
- -

$(gettext 'Boot scripts')

- -
$(cat /var/log/boot.log | filter_taztools_msgs)
- -

$(gettext 'X server')

- -
-$(tail -n 40 /var/log/slim.log | htmlize)
-
$(gettext 'Show more...') + +
+$output
 
EOT ;; diff -r 197057e85b1a -r 7475f4b95a7b lib/libtazpanel --- a/lib/libtazpanel Sun Jan 18 14:23:23 2015 +0100 +++ b/lib/libtazpanel Sun Jan 18 18:59:01 2015 +0100 @@ -68,10 +68,14 @@ # Remove status and ESC char from tazpkg/tazlito commands output filter_taztools_msgs() { - sed -e s'/\[^Gm]*.//g' \ - -e ':a;s/^\(.\{1,68\}\)\(\[ [A-Za-z]* \]\)/\1 \2/;ta' \ - -e 's#\[ OK \]#[ OK ]#' \ - -e 's#\[ Failed \]#[ Failed ]#' + sed -e s'|.\[1;32m||g' \ + -e s'|.\[1;31m||g' \ + -e s'|.\[1;33m||g' \ + -e s'|.\[1;34m||g' \ + -e s'|.\[1;36m||g' \ + -e s'|.\[0;39m||g' \ + -e s'/\[^Gm]*.//g' \ + -e ':a;s/^\(.\{1,68\}\)\(\[ *$(gettext 'Boot logs')