Skip to content
Browse files
Cleanup messageFormatter example to use logs from build steps instead…
… of directly using build logs
  • Loading branch information
anish committed Oct 6, 2014
1 parent 2f5da04 commit 70ede96
Showing 1 changed file with 14 additions and 4 deletions.
@@ -1060,8 +1060,8 @@ For example, if only short emails are desired (e.g., for delivery to phones) ::

Another example of a function delivering a customized html email
containing the last 80 log lines of logs of the last build step is
given below::
containing the last 80 log lines of logs of the last build step that
finished is given below::

from buildbot.status.builder import Results

@@ -1122,8 +1122,18 @@ given below::
text.append(u'<tr><td>%s:</td></tr>' % file['name'] )
# 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():
# 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
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':

0 comments on commit 70ede96

Please sign in to comment.