summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-02-19 17:12:18 +0000
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-03-01 16:18:08 +0000
commit8c5a2c881c74a950901614093de56cc6a5d88dca (patch)
treed6356410612204cb7ae26678f1814c4bfee21597
parent03bdc5cd04646f45baace2e0902690329acb757c (diff)
downloadbuildstream-8c5a2c881c74a950901614093de56cc6a5d88dca.tar.gz
Remove brackets added inside widgets
Brackets can now be added as plain text in a custom logging format string, so there's no need to add them in widgets. widget.py: Remove brackets. _status.py: Remove the 'brackets' optional argument to TimeCode.
-rw-r--r--buildstream/_frontend/status.py2
-rw-r--r--buildstream/_frontend/widget.py25
2 files changed, 7 insertions, 20 deletions
diff --git a/buildstream/_frontend/status.py b/buildstream/_frontend/status.py
index b899274bb..d8739b20b 100644
--- a/buildstream/_frontend/status.py
+++ b/buildstream/_frontend/status.py
@@ -248,7 +248,7 @@ class StatusHeader():
self.error_profile = error_profile
self.pipeline = pipeline
self.scheduler = scheduler
- self.time_code = TimeCode(content_profile, format_profile, brackets=False)
+ self.time_code = TimeCode(content_profile, format_profile)
self.lines = 3
def render_queue(self, queue):
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py
index 6a791b1bc..ecf066bd8 100644
--- a/buildstream/_frontend/widget.py
+++ b/buildstream/_frontend/widget.py
@@ -112,20 +112,17 @@ class Debug(Widget):
def render(self, message):
unique_id = 0 if message.unique_id is None else message.unique_id
- text = self.format_profile.fmt('[pid:')
+ text = self.format_profile.fmt('pid:')
text += self.content_profile.fmt("{: <5}".format(message.pid))
text += self.format_profile.fmt(" id:")
text += self.content_profile.fmt("{:0>3}".format(unique_id))
- text += self.format_profile.fmt(']')
return text
# A widget for rendering the time codes
class TimeCode(Widget):
-
- def __init__(self, content_profile, format_profile, brackets=True, microseconds=False):
- self.brackets = brackets
+ def __init__(self, content_profile, format_profile, microseconds=False):
self.microseconds = microseconds
super(TimeCode, self).__init__(content_profile, format_profile)
@@ -146,21 +143,13 @@ class TimeCode(Widget):
for field in [hours, minutes, seconds]
]
- text = ''
- if self.brackets:
- text += self.format_profile.fmt('[')
-
- text += self.format_profile.fmt(':').join(fields)
+ text = self.format_profile.fmt(':').join(fields)
if self.microseconds:
if elapsed is not None:
text += self.content_profile.fmt(".{0:06d}".format(elapsed.microseconds))
else:
text += self.content_profile.fmt(".------")
-
- if self.brackets:
- text += self.format_profile.fmt(']')
-
return text
@@ -218,11 +207,9 @@ class ElementName(Widget):
if not action_name:
action_name = "Main"
- return self.format_profile.fmt('[') + \
- self.content_profile.fmt("{: >5}".format(action_name.lower())) + \
+ return self.content_profile.fmt("{: >5}".format(action_name.lower())) + \
self.format_profile.fmt(':') + \
- self.content_profile.fmt(self.fmt_string.format(name)) + \
- self.format_profile.fmt(']')
+ self.content_profile.fmt(self.fmt_string.format(name))
# A widget for displaying the primary message text
@@ -262,7 +249,7 @@ class CacheKey(Widget):
else:
text = self.content_profile.fmt(key, dim=missing)
- return self.format_profile.fmt('[') + text + self.format_profile.fmt(']')
+ return text
# A widget for formatting the log file