diff options
authorPau Espin Pedrol <pespin@sysmocom.de>2020-07-20 16:41:44 +0200
committerpespin <pespin@sysmocom.de>2020-09-14 08:45:01 +0000
commit6407c822ae0d45d047deb0dff095f028a90c1ecc (patch)
parente0ed147984e84afec628ee0de6cb9da800b42fe7 (diff)
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
1 files changed, 1 insertions, 1 deletions
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;