#NEWLINE# def write( self , line ) : #NEWLINE# #INDENT# 'Write method.' #NEWLINE# access_m = ColouredWriter . access_re . match ( line ) #NEWLINE# line_m = ColouredWriter . line_re . match ( line ) #NEWLINE# build_m = ColouredWriter . build_re . match ( line ) #NEWLINE# if access_m : #NEWLINE# #INDENT# server = 'LIGHTTPD' #NEWLINE# time = access_m . group ( 3 ) #NEWLINE# who = access_m . group ( 1 ) #NEWLINE# request = access_m . group ( 4 ) #NEWLINE# code = int ( access_m . group ( 5 ) ) #NEWLINE# size = int ( access_m . group ( 6 ) ) #NEWLINE# line = ColouredWriter . coloured_access ( time , request , code , size , server , who ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if line_m : #NEWLINE# #INDENT# server = 'PYTHON' #NEWLINE# time = line_m . group ( 1 ) #NEWLINE# request = line_m . group ( 2 ) #NEWLINE# code = int ( line_m . group ( 3 ) ) #NEWLINE# size = int ( line_m . group ( 4 ) ) #NEWLINE# line = ColouredWriter . coloured_access ( time , request , code , size , server ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if build_m : #NEWLINE# #INDENT# server = 'BUILD' #NEWLINE# time = build_m . group ( 1 ) #NEWLINE# request = build_m . group ( 2 ) #NEWLINE# if request [ 1 : ] . startswith ( 'FAILED' ) : #NEWLINE# #INDENT# build = ColouredWriter . colors [ 'buildfail' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if request [ 1 : ] . startswith ( 'MSG' ) : #NEWLINE# #INDENT# build = ColouredWriter . colors [ 'buildmsg' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# build = ColouredWriter . colors [ 'build' ] #NEWLINE# #UNINDENT# #UNINDENT# endc = ColouredWriter . colors [ 'endc' ] #NEWLINE# line = ( '%s %s %s%s%s\n' % ( build [ : 3 ] , time , build , request , endc ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . stdout . write ( line ) #NEWLINE# self . stdout . flush ( )