Skip to content

Commit

Permalink
Cleanup messageFormatter example to use logs from build steps instead…
Browse files Browse the repository at this point in the history
… of directly using build logs
  • Loading branch information
anish authored and Mikhail Sobolev committed May 18, 2015
1 parent 62fc7a1 commit 29e47f1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions master/docs/manual/cfg-statustargets.rst
Expand Up @@ -192,8 +192,18 @@ Another example of a function delivering a customized html email containing the
text.append(u'<tr><td>%s:</td></tr>' % file['name'] )
text.append(u'</table>')
text.append(u'<br>')
# get log for last step
logs = build.getLogs()
# get all the steps in build in reversed order
rev_steps = reversed(build.getSteps())
# find the last step that finished
for step in rev_steps:
if step.isFinished():
break
# get logs for the last finished step
if step.isFinished():
logs = step.getLogs()
# No step finished, loop just exhausted itself; so as a special case we fetch all logs
else:
logs = build.getLogs()
# logs within a step are in reverse order. Search back until we find stdio
for log in reversed(logs):
if log.getName() == 'stdio':
Expand Down

0 comments on commit 29e47f1

Please sign in to comment.