Skip to content

Commit d80ea91

Browse files
author
Matthew Fisher
committed
fix(client): dump log line if we fail to parse tag
1 parent 816e718 commit d80ea91

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

client/deis.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)