Commit 3561e79
Replace logrus with stdlib log/slog (#655)
* Replace logrus with stdlib log/slog for structured logging
Migrate the entire codebase from github.com/sirupsen/logrus to Go's
standard library log/slog package. This introduces proper structured
logging with key-value pairs and adds LOG_LEVEL environment variable
support (debug, info, warn, error) for runtime log level configuration.
Key changes:
- Replace logging.Logger interface with type alias to *slog.Logger
- Add ParseLevel() and NewLogger() helpers in pkg/logging
- Add NewWriter() to replace logrus.Logger.Writer() for subprocess
output capture
- Update backends.Logger interface to use slog-compatible signatures
- Convert all log calls from printf-style to structured key-value pairs
- Remove direct logrus dependency (remains as indirect via transitive deps)
Closes #384
* Convert all fmt.Sprintf log calls to slog structured key-value pairs
Address review feedback: replace fmt.Sprintf anti-pattern across the
entire codebase with proper slog structured key-value args so log
aggregation tools can parse/filter/query individual fields.
Also fixes:
- t.Error(fmt.Sprintf(...)) -> t.Errorf(...) (staticcheck S1038)
- Import ordering (gci: standard first, then third-party)
- Race condition in testregistry (concurrent map access in handleBlobUpload)
- Removed unused fmt imports
* Fix lint: gci import ordering and staticcheck S1038
Sort stdlib imports alphabetically in main.go, remove unused fmt
import and trailing blank line in scheduler_test.go, and replace
t.Error(fmt.Sprintf(...)) with t.Errorf(...) in test files.
* Address reviewer feedback: restore Fatal exit behavior, fix structured logging
- Add os.Exit(1) after log.Error where log.Fatal was originally used
(prevents app from continuing with nil backends/listeners)
- Convert all remaining fmt.Sprintf log calls to proper slog key-value
pairs for structured logging benefits
- Restore createLlamaCppConfigFromEnv Fatal exit behavior via exitFunc
- Fix test assertions: restore t.Fatalf for setup errors, use t.Errorf
for assertion checks
- Fix gci import ordering (log/slog in correct alphabetical position)
- Remove trailing newlines from log messages
* fix: resolve rebase conflicts - convert new upstream logrus calls to slog
Convert new logrus-style logging calls (Infof, Errorf, Warnf, Infoln) added
in upstream to slog structured logging pattern. Fix go.mod dependencies and
test file imports after rebase onto latest main.
* fix: resolve rebase conflicts, lint and test fixes after slog migration
- Fixed import ordering (gci) in select_backend_test.go
- Fixed tc.log -> c.log typo in client.go
- Moved logrus from direct to indirect dependency in go.mod
- All tests pass, go vet clean, golangci-lint passes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent c0d3c09 commit 3561e79
File tree
39 files changed
+436
-401
lines changed- pkg
- anthropic
- distribution/distribution
- inference
- backends
- diffusers
- llamacpp
- mlx
- sglang
- vllm
- models
- scheduling
- internal/dockerhub
- logging
- metrics
- ollama
- responses
- routing
39 files changed
+436
-401
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| |||
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
259 | | - | |
| 258 | + | |
| 259 | + | |
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
| |||
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
| 355 | + | |
354 | 356 | | |
355 | 357 | | |
356 | 358 | | |
| |||
391 | 393 | | |
392 | 394 | | |
393 | 395 | | |
| 396 | + | |
394 | 397 | | |
395 | 398 | | |
396 | 399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | | - | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
37 | 45 | | |
38 | 46 | | |
39 | 47 | | |
40 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
41 | 52 | | |
42 | 53 | | |
43 | 54 | | |
| |||
49 | 60 | | |
50 | 61 | | |
51 | 62 | | |
52 | | - | |
| 63 | + | |
| 64 | + | |
53 | 65 | | |
54 | 66 | | |
55 | 67 | | |
| |||
91 | 103 | | |
92 | 104 | | |
93 | 105 | | |
94 | | - | |
| 106 | + | |
95 | 107 | | |
96 | | - | |
| 108 | + | |
97 | 109 | | |
98 | 110 | | |
99 | | - | |
| 111 | + | |
100 | 112 | | |
101 | 113 | | |
102 | | - | |
| 114 | + | |
103 | 115 | | |
104 | 116 | | |
105 | | - | |
| 117 | + | |
106 | 118 | | |
107 | 119 | | |
108 | 120 | | |
| |||
119 | 131 | | |
120 | 132 | | |
121 | 133 | | |
122 | | - | |
| 134 | + | |
123 | 135 | | |
124 | 136 | | |
125 | 137 | | |
| |||
135 | 147 | | |
136 | 148 | | |
137 | 149 | | |
138 | | - | |
| 150 | + | |
139 | 151 | | |
140 | 152 | | |
141 | | - | |
| 153 | + | |
142 | 154 | | |
143 | 155 | | |
144 | 156 | | |
145 | | - | |
| 157 | + | |
| 158 | + | |
146 | 159 | | |
147 | 160 | | |
148 | 161 | | |
149 | 162 | | |
150 | 163 | | |
151 | | - | |
| 164 | + | |
152 | 165 | | |
153 | 166 | | |
154 | 167 | | |
155 | 168 | | |
156 | 169 | | |
157 | | - | |
| 170 | + | |
158 | 171 | | |
159 | 172 | | |
160 | 173 | | |
| |||
168 | 181 | | |
169 | 182 | | |
170 | 183 | | |
171 | | - | |
| 184 | + | |
172 | 185 | | |
173 | 186 | | |
174 | 187 | | |
175 | 188 | | |
176 | 189 | | |
177 | 190 | | |
178 | | - | |
| 191 | + | |
179 | 192 | | |
180 | 193 | | |
181 | 194 | | |
| |||
186 | 199 | | |
187 | 200 | | |
188 | 201 | | |
189 | | - | |
| 202 | + | |
| 203 | + | |
190 | 204 | | |
191 | 205 | | |
192 | 206 | | |
| |||
204 | 218 | | |
205 | 219 | | |
206 | 220 | | |
207 | | - | |
| 221 | + | |
208 | 222 | | |
209 | 223 | | |
210 | 224 | | |
| |||
213 | 227 | | |
214 | 228 | | |
215 | 229 | | |
216 | | - | |
| 230 | + | |
| 231 | + | |
217 | 232 | | |
218 | 233 | | |
219 | 234 | | |
220 | 235 | | |
221 | | - | |
| 236 | + | |
| 237 | + | |
222 | 238 | | |
223 | 239 | | |
224 | 240 | | |
| |||
243 | 259 | | |
244 | 260 | | |
245 | 261 | | |
246 | | - | |
| 262 | + | |
| 263 | + | |
247 | 264 | | |
248 | | - | |
249 | | - | |
| 265 | + | |
| 266 | + | |
250 | 267 | | |
251 | | - | |
| 268 | + | |
| 269 | + | |
252 | 270 | | |
253 | 271 | | |
254 | 272 | | |
255 | 273 | | |
256 | 274 | | |
257 | 275 | | |
258 | | - | |
| 276 | + | |
| 277 | + | |
259 | 278 | | |
260 | 279 | | |
261 | 280 | | |
| |||
265 | 284 | | |
266 | 285 | | |
267 | 286 | | |
268 | | - | |
| 287 | + | |
269 | 288 | | |
270 | 289 | | |
271 | 290 | | |
| |||
293 | 312 | | |
294 | 313 | | |
295 | 314 | | |
296 | | - | |
| 315 | + | |
297 | 316 | | |
298 | 317 | | |
299 | 318 | | |
300 | | - | |
| 319 | + | |
301 | 320 | | |
302 | 321 | | |
303 | | - | |
304 | | - | |
| 322 | + | |
| 323 | + | |
305 | 324 | | |
306 | | - | |
| 325 | + | |
307 | 326 | | |
308 | 327 | | |
309 | | - | |
| 328 | + | |
310 | 329 | | |
311 | | - | |
| 330 | + | |
312 | 331 | | |
313 | 332 | | |
314 | | - | |
| 333 | + | |
315 | 334 | | |
316 | | - | |
| 335 | + | |
317 | 336 | | |
318 | 337 | | |
319 | | - | |
| 338 | + | |
320 | 339 | | |
321 | 340 | | |
322 | 341 | | |
| |||
337 | 356 | | |
338 | 357 | | |
339 | 358 | | |
340 | | - | |
| 359 | + | |
| 360 | + | |
341 | 361 | | |
342 | 362 | | |
343 | 363 | | |
344 | 364 | | |
345 | | - | |
| 365 | + | |
346 | 366 | | |
347 | 367 | | |
348 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
64 | | - | |
65 | | - | |
66 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
67 | 66 | | |
68 | | - | |
69 | | - | |
70 | 67 | | |
71 | | - | |
| 68 | + | |
72 | 69 | | |
73 | 70 | | |
74 | | - | |
75 | 71 | | |
76 | 72 | | |
77 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
0 commit comments