Bug#928920: patch: Introduce logging functions that check ${VERBOSE}
Dmitry Bogatov <[email protected]> Mon, 13 May 2019 04:05:23 +0000
| Newsgroups | gmane.linux.debian.devel.lsb |
|---|---|
| Message-ID | <E1hQ2D9-000219-F4__45605.9082107217$1557720572$gmane$org@eggs.gnu.org> |
--16969_Mon_May_13_04_05_23_UTC_2019 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Package: lsb-base Severity: wishlist Tags: patch =46rom 58dd6e6add24a4e5531a84ff2404f2f5ed71e114 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov <[email protected]> Date: Sat, 11 May 2019 21:20:48 +0000 Subject: [PATCH] Introduce logging functions that check ${VERBOSE} Use of logging functions in initscripts are often conditioned on value of $VERBOSE variable, causing same code to be repeated over and over again. This change introduce number of logging functions (with prefix "v") that are functionally equivalent to their counterparts without prefix when value of $VERBOSE is not "no", and do nothing if value of $VERBOSE is "no". --- conf/conf.yaml | 7 +++++++ debian/control | 1 + debian/lsb-base.install | 1 + debian/rules | 4 ++++ init-functions.d/.gitignore | 1 + init-functions.d/00-verbose.jinja | 9 +++++++++ 6 files changed, 23 insertions(+) create mode 100644 conf/conf.yaml create mode 100644 init-functions.d/.gitignore create mode 100644 init-functions.d/00-verbose.jinja diff --git a/conf/conf.yaml b/conf/conf.yaml new file mode 100644 index 0000000..d1ac18b --- /dev/null +++ b/conf/conf.yaml @@ -0,0 +1,7 @@ +log_functions: + - log_daemon_msg + - log_begin_msg + - log_end_msg + - log_action_msg + - log_action_begin_msg + - log_action_end_msg diff --git a/debian/control b/debian/control index b39cdc6..e4746d2 100644 --- a/debian/control +++ b/debian/control @@ -9,6 +9,7 @@ Build-Depends: debhelper (>> 11~), python3-all:any, dh-python, distro-info-data, + ionit Standards-Version: 4.2.1 Homepage: https://wiki.linuxfoundation.org/lsb/start Vcs-Browser: https://salsa.debian.org/debian/lsb diff --git a/debian/lsb-base.install b/debian/lsb-base.install index 66dc0df..d2d9588 100644 --- a/debian/lsb-base.install +++ b/debian/lsb-base.install @@ -1,2 +1,3 @@ init-functions /lib/lsb +init-functions.d/00-verbose /lib/lsb/init-functions.d init-functions.d/20-left-info-blocks /lib/lsb/init-functions.d diff --git a/debian/rules b/debian/rules index 33c4aff..32789c5 100755 --- a/debian/rules +++ b/debian/rules @@ -8,6 +8,10 @@ PY3VERSIONS=3D$(shell [ -x /usr/bin/py3versions ] && py3ve= rsions -vr) %: dh $@ --with python3 = +override_dh_auto_build: + dh_auto_build + ionit -c conf -t init-functions.d + # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?=3D $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) diff --git a/init-functions.d/.gitignore b/init-functions.d/.gitignore new file mode 100644 index 0000000..876584d --- /dev/null +++ b/init-functions.d/.gitignore @@ -0,0 +1 @@ +00-verbose diff --git a/init-functions.d/00-verbose.jinja b/init-functions.d/00-verbos= e.jinja new file mode 100644 index 0000000..15916aa --- /dev/null +++ b/init-functions.d/00-verbose.jinja @@ -0,0 +1,9 @@ +## Generated automatically. Do not edit! -*- shell-script -*- +{% for fn in log_functions %} +v{{ fn }} () { + if test "${VERBOSE:-yes}" !=3D no ; then + {{ fn }} "$@" + fi +} +{% endfor %} +# vim: ft=3Dsh -- = Note, that I send and fetch email in batch, once every 24 hours. If matter is urgent, try https://t.me/kaction = -- --16969_Mon_May_13_04_05_23_UTC_2019 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEhnHVzDbtdH7ktKj4SBLY3qgmEeYFAlzY7QMACgkQSBLY3qgm EebnQhAAobZVH44DTniHMQkeICP7fI4JwgoyHaRZLIUUMsgYb2SPEGb0Po7KgGmc 7/UISFWd1JmqaKJILkyonoWJN30Q4aMELs4fXCmrfkf6pKBn3u5ERl9LLbX4rNSK BI+yPEJPCAuqdBTcBZm+e+ki1oZW0buCFOy2iuQK5GDev0NNtW4ueKLu5PXzL3na QUwytXZYU9hNHSMLXjjx5qysqEf6PTLvjacInZtBExywfKNx7XBoKez5v0rNtekH P/aveYc2FHvd3yOwi6QZSblt+1QOC9Az+DzVRdsxw7SeAX/kdeRrDRdqyu0t0rvE jLCDoVPBByauGqRCILYDq7uoRmR4qUbDeRE0PvUFiJYZWo+deoyG7hghFMZZPDiT ttWwORITWrP2t/LDmRshX7V4S6h7R2EV2pAPzC/eOOB+KTb260mZCr0ef8+p86n/ 1u+QHtKIWXbymoKiK3mESeUR4cCZ3TNniTl/tK/s7ztbYqUijORdZJMrZlF0mqM1 dmyDpSVLEIX7KIlTJ8I3LKavrd1ZnNYWZgz5xcJWYEe2qZrdxLUQn64bcK/EGr4a K7qf67wYl+bZCGWmPhW3/P/LR18G5ajDZ6ZTBWZ/vXMRZJM0XgrRB1qHhwX7d66Q zAnRU2FIG+5dg5hxNQ6aP0xzFwZKWQGpEqNaycbeck7BptxSdMU= =LDxv -----END PGP SIGNATURE----- --16969_Mon_May_13_04_05_23_UTC_2019--