summaryrefslogtreecommitdiff
path: root/buildstream/_frontend/widget.py
diff options
context:
space:
mode:
authorWilliam Salmon <will.salmon@codethink.co.uk>2018-12-20 15:07:49 +0000
committerWilliam Salmon <will.salmon@codethink.co.uk>2019-02-07 09:42:36 +0000
commit7285e87ec56aad9e88f90e7d8c4524e5cf477bdf (patch)
treef204d6422d6a04816e14aa988b9ebcd42c01cd0f /buildstream/_frontend/widget.py
parent1a75b252ba4b91ab4d3c84cb5081d1039d1c3f0f (diff)
downloadbuildstream-7285e87ec56aad9e88f90e7d8c4524e5cf477bdf.tar.gz
Add more log formatting options
The 'wallclock-us' is a option that we thought we already had.
Diffstat (limited to 'buildstream/_frontend/widget.py')
-rw-r--r--buildstream/_frontend/widget.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py
index c5353bc43..de122f8a3 100644
--- a/buildstream/_frontend/widget.py
+++ b/buildstream/_frontend/widget.py
@@ -94,12 +94,24 @@ class FixedText(Widget):
# Used to add the wallclock time this message was created at
class WallclockTime(Widget):
+ def __init__(self, context, content_profile, format_profile, output_format=False):
+ self._output_format = output_format
+ super(WallclockTime, self).__init__(context, content_profile, format_profile)
+
def render(self, message):
+
fields = [self.content_profile.fmt("{:02d}".format(x)) for x in
[message.creation_time.hour,
message.creation_time.minute,
- message.creation_time.second]]
- return self.format_profile.fmt(":").join(fields)
+ message.creation_time.second,
+ ]
+ ]
+ text = self.format_profile.fmt(":").join(fields)
+
+ if self._output_format == 'us':
+ text += self.content_profile.fmt(".{:06d}".format(message.creation_time.microsecond))
+
+ return text
# A widget for rendering the debugging column
@@ -326,6 +338,7 @@ class LogLine(Widget):
"elapsed": TimeCode(context, content_profile, format_profile, microseconds=False),
"elapsed-us": TimeCode(context, content_profile, format_profile, microseconds=True),
"wallclock": WallclockTime(context, content_profile, format_profile),
+ "wallclock-us": WallclockTime(context, content_profile, format_profile, output_format='us'),
"key": CacheKey(context, content_profile, format_profile, err_profile),
"element": ElementName(context, content_profile, format_profile),
"action": TypeName(context, content_profile, format_profile),