--- /dev/null
+lsb (4.1+Debian0+) UNRELEASED; urgency=low
+
+ This version implements a new "fancy" output in the form of "[....] "
+ blocks prepended to the daemon status messages:
+
+ Before:
+ Starting/stopping long daemon name: daemond daemon2d
+ After:
+ [....] Starting/stopping long daemon name: daemond daemon2d
+
+ This block will become either a green [ ok ], a yellow [warn]
+ or a red [FAIL] depending on the daemon exit status.
+
+ == How do I disable this? ==
+
+ This is currently implemented in /lib/lsb/init-functions as _pre and
+ _post functions. As such, they are overridable as function definitions
+ in the /etc/lsb-base-logging.sh configuration file; for example:
+
+ log_daemon_msg_pre () { :; }
+
+ It is also possible to completely disable the "Fancy output" by setting
+ the FANCYTTY variable to 0 in the same file.
+
+ == Known bugs and plan for inclusion in unstable ==
+
+ * Daemons writing too much information on the screen (hence getting
+ their output spawned on multiple lines) won't get their [....]
+ replaced by [ ok ] as the replacement will happen on the last input
+ line.
+ * The above has the side-effect of hiding 7 characters of potentially
+ useful output.
+ * init.d scripts not using the /lib/lsb/init-functions provided
+ functions will (obviously) not get the fancy output.
+
+ Feedback, ideas and help are welcome as bugs on the lsb-base package.
+
+ Before including this change to unstable, the following changes will
+ most probably happen:
+
+ * The implementation will move from _pre/_post functions to the
+ functions themselves. This is safe-guarded by the FANCYTTY global
+ variable anyway.
+ * The information from this NEWS file will get moved to README.Debian
+ (hence avoiding the gory details to stable-upgrading users).
+
+ -- Didier Raboud <odyx@debian.org> Sat, 31 Mar 2012 17:06:27 +0200
# int log_begin_message (char *message)
log_begin_msg () {
+ log_begin_msg_pre "$@"
if [ -z "${1:-}" ]; then
return 1
fi
/bin/echo -n "$@"
+ log_begin_msg_post "$@"
}
# Sample usage:
}
log_action_begin_msg () {
+ log_action_begin_msg_pre "$@"
/bin/echo -n "$@..."
+ log_action_begin_msg_post "$@"
}
log_action_cont_msg () {
}
# Hooks for /etc/lsb-base-logging.sh
-log_daemon_msg_pre () { :; }
+log_daemon_msg_pre () {
+ if log_use_fancy_output; then
+ /bin/echo -n "[....] "
+ fi
+}
log_daemon_msg_post () { :; }
-log_end_msg_pre () { :; }
+log_begin_msg_pre () {
+ log_daemon_msg_pre "$@"
+}
+log_begin_msg_post() { :; }
+log_end_msg_pre () {
+ if log_use_fancy_output; then
+ RED=$( $TPUT setaf 1)
+ GREEN=$( $TPUT setaf 2)
+ YELLOW=$( $TPUT setaf 3)
+ NORMAL=$( $TPUT op)
+
+ $TPUT sc
+ $TPUT hpa 0
+ /bin/echo -n "["
+ if [ $1 -eq 0 ]; then
+ /bin/echo -ne "${GREEN} ok "
+ elif [ $1 -eq 255 ]; then
+ /bin/echo -ne "${YELLOW}warn"
+ else
+ /bin/echo -ne "${RED}FAIL"
+ fi
+ /bin/echo -ne "${NORMAL}]"
+ $TPUT rc
+ fi
+}
log_end_msg_post () { :; }
-log_action_end_msg_pre () { :; }
+log_action_begin_msg_pre () {
+ log_daemon_msg_pre "$@"
+}
+log_action_begin_msg_post () { :; }
+log_action_end_msg_pre () {
+ log_end_msg_pre "$@"
+}
log_action_end_msg_post () { :; }
FANCYTTY=