From 6407c822ae0d45d047deb0dff095f028a90c1ecc Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 20 Jul 2020 16:41:44 +0200 Subject: logging: Avoid printing OSMO_LOGCOLOR_END if no color was used There's no point in printing that code if no color was used in first place, and looks strange when using logging with color enabled but no color assigned to the category printing lines. Only affected unit test output by this fix is osmo-bts'x tx_power_test.c, which has been fixed in osmo-bts.git Change-Id I5aa95997c8df4ce5ba8271acae99c45f68b96e11. Change-Id: Ie38cc639d7f4acd908f357e5bfb3ced07147583e --- src/logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/logging.c b/src/logging.c index db04cf7e..af64541c 100644 --- a/src/logging.c +++ b/src/logging.c @@ -505,7 +505,7 @@ static void _output(struct log_target *target, unsigned int subsys, } } - if (target->use_color) { + if (target->use_color && c_subsys) { ret = snprintf(buf + offset, rem, OSMO_LOGCOLOR_END); if (ret < 0) goto err; -- cgit v1.2.3