* moved colour macros into `src/ec_cmd_log.hrl`
* moved `ec_cmd_log` tests into `test/ec_cmd_log_tests.erl`.
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
Basically this adds a new/3 with a third argument of intensity.
The default (and by that the behaviour of new/1 and /2) remain
unchanged so existing code isn't affected.
If intenisty is set to `low` (instead of `high`) then only the
prefix is coloured making the whole output less colourful and
for some cases easyer to read.
When erlware_commons logs to the command_line, it assumes the
environment has common modern capabilities and color display. In
general, this is not the case and then color codes are sent verbatim
to the terminal.
This patch introduces a new field in #state_t{}, term_cap, encoding
if the terminal runs with 'full' or 'dumb' capabilities. In the latter case,
color display is suppressed. Initialization of the #state_t{} record queries
the environment once for the TERM variable in order to figure out what
it supports. The default is 'full' capability to be fully backwards compatible.