Commit 55c47b0
committed
fix: prefix external command output for better log clarity
Most log output uses the package name as a prefix (via FromagerLogRecord)
so it is possible to tell which package is being processed when a message
is logged. However, external command output (like uv) lacked both:
1. Visual indication that it came from an external command
2. Package name on continuation lines for grep
This fix adds the package name to every line of external command output
and uses a visual prefix (' > ') to distinguish it from fromager's own
messages. The package name is retrieved from the log context and manually
added to each continuation line, enabling grep to find all lines related
to a specific package (e.g., `grep 'numpy:'`).
Implementation:
- Use shlex.join() for command formatting
- Single logger call combining command info and output
- str.replace() to add prefixes to each line
- Package name manually added to continuation lines for greppability
Benefits:
- Every line has package name prefix for grep
- Visual clarity: '> ' prefix distinguishes external command output
- Parallel builds: Single log call prevents line interleaving
- Simple implementation with no code duplication
Example output:
numpy: command failed with exit code 1: uv pip install numpy
numpy: > Resolving dependencies...
numpy: > Error: Could not find package
Fixes: #753
Co-authored-by: Claude <claude@anthropic.com>
Signed-off-by: Ioannis Angelakopoulos <iangelak@redhat.com>1 parent 1fd83c3 commit 55c47b0
2 files changed
Lines changed: 35 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
101 | 118 | | |
102 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
103 | 128 | | |
104 | 129 | | |
105 | 130 | | |
| |||
113 | 138 | | |
114 | 139 | | |
115 | 140 | | |
116 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
117 | 146 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
0 commit comments