in src/buildstream/_frontend/widget.py [0:0]
def _render(self, message):
# Render the column widgets first
text = ""
for widget in self._columns:
text += widget.render(message)
text += "\n"
extra_nl = False
# Now add some custom things
if message.detail:
# Identify frontend messages, we never abbreviate these
frontend_message = not message.element_name
# Split and truncate message detail down to message_lines lines
lines = message.detail.splitlines(True)
n_lines = len(lines)
abbrev = False
if message.message_type not in ERROR_MESSAGES and not frontend_message and n_lines > self._message_lines:
lines = lines[0 : self._message_lines]
if self._message_lines > 0:
abbrev = True
else:
lines[n_lines - 1] = lines[n_lines - 1].rstrip("\n")
detail = self._indent + self._indent.join(lines)
text += "\n"
if message.message_type in ERROR_MESSAGES:
text += self._err_profile.fmt(detail, bold=True)
else:
text += self._detail_profile.fmt(detail)
if abbrev:
text += self._indent + self.content_profile.fmt(
"Message contains {} additional lines".format(n_lines - self._message_lines), dim=True
)
text += "\n"
extra_nl = True
if message.scheduler and message.message_type == MessageType.FAIL:
text += "\n"
if self.context is not None and not self.context.log_verbose:
text += self._indent + self._err_profile.fmt("Log file: ")
text += self._indent + self._logfile_widget.render(message) + "\n"
elif self._log_lines > 0:
text += (
self._indent
+ self._err_profile.fmt("Printing the last {} lines from log file:".format(self._log_lines))
+ "\n"
)
text += self._indent + self._logfile_widget.render_abbrev(message, abbrev=False) + "\n"
text += self._indent + self._err_profile.fmt("=" * 70) + "\n"
log_content = self._read_last_lines(message.logfile)
log_content = textwrap.indent(log_content, self._indent)
text += self._detail_profile.fmt(log_content)
text += "\n"
text += self._indent + self._err_profile.fmt("=" * 70) + "\n"
extra_nl = True
if extra_nl:
text += "\n"
return text