summaryrefslogtreecommitdiffstats
path: root/src/logging.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-07-30 21:01:54 +0200
committerHarald Welte <laforge@gnumonks.org>2010-07-30 21:01:54 +0200
commita439a3a505d5eb5630c4f131c7293fec019973a8 (patch)
tree59655156d29363ace6c8eaa106e9bfd43050ffa6 /src/logging.c
parentdee47cd14dc426c45253f576edaae9fe9c4e028a (diff)
logging: Make sure we don't use "end of color" code if colors are turned off
Diffstat (limited to 'src/logging.c')
-rw-r--r--src/logging.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/logging.c b/src/logging.c
index 2cc44e79..30316a5f 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -164,7 +164,8 @@ static void _output(struct log_target *target, unsigned int subsys,
sub[sizeof(sub)-1] = '\0';
}
- snprintf(final, sizeof(final), "%s%s%s%s\033[0;m", col, tim, sub, buf);
+ snprintf(final, sizeof(final), "%s%s%s%s%s", col, tim, sub, buf,
+ target->use_color ? "\033[0;m" : "");
final[sizeof(final)-1] = '\0';
target->output(target, final);
}