Commit 88a149b
authored
fix(google-cloud):
### 🐞 Problem
The `google_cloud` formatter crashes when it receives a crash log where
the `user context` contains values that are not binaries (e.g.,
integers). This happens because the formatter uses the `<>` operator for
string concatenation, which raises an error when used with non-binary
types.
**Truncated example of a crashed log:**
```bash
2025-01-01T01:01:01.000000+00:00 error: FORMATTER CRASH: {string,<<"** (Postgrex.Error) ERROR 428...
```
### ✅ Solution
This PR replaces the use of the `<>` operator with `Enum.join/2` when
formatting key-value pairs. This approach safely converts all values to
strings before concatenation, preventing crashes when values are not
binaries.format_affected_user/1 with non-binary values (#161)1 parent 6e77680 commit 88a149b
File tree
2 files changed
+29
-5
lines changed- lib/logger_json/formatters
- test/logger_json/formatters
2 files changed
+29
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
| 341 | + | |
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
365 | 389 | | |
366 | 390 | | |
367 | 391 | | |
| |||
0 commit comments