twister: Remove ANSI sequences before writing to handler.log

ANSI color is great for viewing output in a terminal, but currently it
also gets written out to the `handler.log` file. Text editors usually
don't render these, resulting in a hard-to-read file with a lot of
gibberish interspered. This commit strips ANSI sequences from lines
before writing them to the handler log file. This change does not
affect what is printed in Twister's console output, so one would still
see the colors there.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2 files changed