def write(self, line):
            line_m = ColouredWriter.line_re.match(line)
            if line_m:
                time = line_m.group(1)
                request = line_m.group(2)
                code = int(line_m.group(3))
                size = int(line_m.group(4))
                if code >= 500:
                    command = ColouredWriter.colors['fail']
                elif code >= 400:
                    command = ColouredWriter.colors['warning']
                elif code == 301:
                    command = ColouredWriter.colors['fail'] # We don't want any 301s from our links...
                elif code >= 300:
                    command = ColouredWriter.colors['okgreen']
                elif code >= 200:
                    command = ColouredWriter.colors['okblue']
                else:
                    command = ColouredWriter.colors['unknown']

                if code in ColouredWriter.status_code_text:
                    meaning = ColouredWriter.status_code_text[code]
                else:
                    meaning = "*unknown*"

                self.stdout.write(time)
                set_text_attr(command | self.default_bg)
                self.stdout.write(" " + request)
                set_text_attr(self.default_colors)
                self.stdout.write(" %i %i (%s)\n" % (code, size, meaning))
            else:
                build_m = ColouredWriter.build_re.match(line)
                if build_m:
                    time = build_m.group(1)
                    request = build_m.group(2)
                    self.stdout.write(time + ' ')
                    if request[1:].startswith("FAILED"):
                        set_text_attr(ColouredWriter.colors['fail'])
                    else:
                        set_text_attr(ColouredWriter.colors['build'] | self.default_bg)
                    self.stdout.write("%s" % (request))
                    set_text_attr(self.default_colors)
                    self.stdout.write("\n")
                else:
                    self.stdout.write(line)
Write method.
dataset/ETHPy150Open turbulenz/turbulenz_tools/turbulenz_tools/utils/coloured_writer.py/ColouredWriter.write