Optimize terminal detection 73/217573/2
authorMateusz Majewski <m.majewski2@samsung.com>
Fri, 8 Nov 2019 09:32:10 +0000 (10:32 +0100)
committerMateusz Majewski <m.majewski2@samsung.com>
Wed, 13 Nov 2019 11:59:50 +0000 (12:59 +0100)
commitb40d1a0f40b25c384622a64b4e12994bb6319c51
tree45259982ddc83376cb0b6d065cc67270a2fe9a0e
parent1e758e97808b5df6bd1b4203bb3401c1464d7a1b
Optimize terminal detection

dlogutil needs to check if it's printing to the terminal or not in order
to see if it needs to apply colors or not in the automatic color mode.
Previously, we checked this repeatedly on every log we printed. However,
whether we are printing to the terminal or not shouldn't change at all.
Therefore, we should only check this once, during setup, and then never
call isatty() again. This commit achieves that.

Change-Id: I2084a4efbfeab057f33028a4b298a929aa3d5851
Makefile.am
include/log_file.h
include/logprint.h
src/shared/log_file.c
src/shared/logprint.c
src/tests/log_file.c
src/tests/logprint.c