MCPcopy
hub / github.com/qtile/qtile / format

Method format

libqtile/log_utils.py:41–56  ·  view source on GitHub ↗

Format the record with colors.

(self, record: LogRecord)

Source from the content-addressed store, hash-verified

39 bold_seq = "\033[1m"
40
41 def format(self, record: LogRecord) -> str:
42 """Format the record with colors."""
43 color = self.color_seq % (30 + self.colors[record.levelname])
44 message = Formatter.format(self, record)
45 message = (
46 message.replace("$RESET", self.reset_seq)
47 .replace("$BOLD", self.bold_seq)
48 .replace("$COLOR", color)
49 )
50 for color, value in self.colors.items():
51 message = (
52 message.replace("$" + color, self.color_seq % (value + 30))
53 .replace("$BG" + color, self.color_seq % (value + 40))
54 .replace("$BG-" + color, self.color_seq % (value + 40))
55 )
56 return message + self.reset_seq
57
58
59def get_default_log() -> Path:

Callers 15

test_qtile_cmdFunction · 0.80
assert_focusedFunction · 0.80
treeFunction · 0.80
notificationFunction · 0.80
test_notificationsFunction · 0.80
__repr__Method · 0.80
convert_deprecated_listFunction · 0.80
__call__Method · 0.80
walk_bindingMethod · 0.80
urlMethod · 0.80
parseMethod · 0.80
refreshMethod · 0.80

Calls 1

itemsMethod · 0.45

Tested by 4

test_qtile_cmdFunction · 0.64
treeFunction · 0.64
notificationFunction · 0.64
test_notificationsFunction · 0.64