Skip to content

Commit 5f89f65

Browse files
Add dim text formatting for log output
- Introduced a new `_dim` function to apply dim styling to text in log outputs. - Updated `print_log` function to use dim formatting for timestamps and log types, enhancing readability. - Added conditional dim formatting for log data, improving visual distinction in log messages.
1 parent a19a73f commit 5f89f65

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

auralogger/cli/log_print.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ def _rgb(text: str, rgb: Any) -> str:
2020
return text
2121

2222

23+
def _dim(text: str) -> str:
24+
return f"\033[2m{text}\033[0m"
25+
26+
2327
def _print_stdout_line(parts: str) -> None:
2428
"""Avoid UnicodeEncodeError on Windows consoles that default to a legacy code page."""
2529
try:
@@ -41,13 +45,17 @@ def print_log(log: Mapping[str, Any], config_styles: Any) -> None:
4145

4246
line1 = " ".join(
4347
(
44-
_rgb(str(created), spec.get("time-color")),
48+
_dim(_rgb(str(created), spec.get("time-color"))),
4549
str(icon),
46-
_rgb(str(type_disp), spec.get("type-color")),
50+
_dim(_rgb(str(type_disp), spec.get("type-color"))),
4751
_rgb(str(loc), spec.get("location-color")),
4852
)
4953
)
5054
_print_stdout_line(line1)
5155

5256
msg = log.get("message")
5357
_print_stdout_line(_rgb(str(msg if msg is not None else ""), spec.get("message-color")))
58+
59+
data = log.get("data")
60+
if data is not None and str(data).strip():
61+
_print_stdout_line(_dim(_rgb(str(data), spec.get("text-color"))))

0 commit comments

Comments
 (0)