Bug 1250080 - [RFE] make ANSI color coding of output optional
Summary: [RFE] make ANSI color coding of output optional
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: rawhide
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
Assignee: Dalibor Pospíšil
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 483014
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-04 13:27 UTC by Ales Zelinka
Modified: 2019-05-07 11:52 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-05-07 11:49:39 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1309068 0 unspecified CLOSED [RFE] Allow users specify if task will run with tty enabled/disabled 2021-02-22 00:41:40 UTC

Internal Links: 1309068

Description Ales Zelinka 2015-08-04 13:27:22 UTC
restraint uses ANSI color coding in the logs even if the user/consumer expects plain text. This makes logs hard to read and parse.

:: [[0;32m   PASS   [0m] :: Creating tmp directory (Expected 0, got 0)
:: [[0;32m   PASS   [0m] :: Command 'chmod a+rx /tmp/tmp.sonUBNhf6Z' (Expected 0, got 0)
:: [[0;32m   PASS   [0m] :: Command 'skfjhxshg=/tmp/tmp.sonUBNhf6Z' (Expected 0, got 0)

Comment 2 Dan Callaghan 2015-08-05 04:02:52 UTC
I think the coloured output here is actually coming from beakerlib, right? Beakerlib thinks it's writing to a terminal because restraint runs tests attached to a pty, even though it's really just saving the output to a log file.

Comment 3 Bill Peck 2015-08-10 17:51:02 UTC
Maybe we could set a env variable that beakerlib could use to disable the ansi color when set.

  #@staticmethod
  def printLog(message, prefix="LOG"):
    color = uncolor = ""
    if sys.stdout.isatty() and prefix in ("PASS", "FAIL", "INFO", "WARNING"):
      color = termColors[prefix]
      uncolor = "\033[0m"


would need to be updated..

Comment 4 Ales Zelinka 2015-08-14 12:25:37 UTC
(In reply to Dan Callaghan from comment #2)
> I think the coloured output here is actually coming from beakerlib, right?

right. reassigning again...

Comment 5 Dalibor Pospíšil 2015-08-14 14:57:51 UTC
This could be also done together with bz483014.

Comment 6 Peter Hostačný 2016-02-18 23:42:52 UTC
@azelinka: Is this bug only restraint related ? (Do you think this feature is needed at beakerlib even if this will be resolved in restraint ?)

Comment 7 Ales Zelinka 2016-02-19 16:00:38 UTC
this was filed against restraint by mistake, it's beakerlib bug that should be fixed in beakerlib. AFAIK.

Comment 8 Jakub Prokes 2016-02-22 11:07:19 UTC
In my opinion the root of problem is in terminal checking, because there isn't check for env. variable TERM for compatible terminal (xterm* or vt100).

Comment 9 Dalibor Pospíšil 2019-05-07 11:49:39 UTC
coloring is now limitted to specific terminals


Note You need to log in before you can comment on or make changes to this bug.