File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -610,19 +610,22 @@ def apps_logs(self, args):
610610 # strip the last newline character
611611 for line in response .json ().split ('\n ' )[:- 1 ]:
612612 # get the tag from the log
613- log_tag = line .split (': ' )[0 ].split (' ' )[1 ]
614- # colorize the log based on the tag
615- color = sum ([ord (ch ) for ch in log_tag ]) % 6
616- def f (x ):
617- return {
618- 0 : 'green' ,
619- 1 : 'cyan' ,
620- 2 : 'red' ,
621- 3 : 'yellow' ,
622- 4 : 'blue' ,
623- 5 : 'magenta' ,
624- }.get (x , 'magenta' )
625- self ._logger .info (colored (line , f (color )))
613+ try :
614+ log_tag = line .split (': ' )[0 ].split (' ' )[1 ]
615+ # colorize the log based on the tag
616+ color = sum ([ord (ch ) for ch in log_tag ]) % 6
617+ def f (x ):
618+ return {
619+ 0 : 'green' ,
620+ 1 : 'cyan' ,
621+ 2 : 'red' ,
622+ 3 : 'yellow' ,
623+ 4 : 'blue' ,
624+ 5 : 'magenta' ,
625+ }.get (x , 'magenta' )
626+ self ._logger .info (colored (line , f (color )))
627+ except IndexError :
628+ self ._logger .info (line )
626629 else :
627630 raise ResponseError (response )
628631
You can’t perform that action at this time.
0 commit comments