Commit 602ca74
authored
refactor: enhance logging with caller information and structured output (#137)
- Add imports for `path/filepath` and `runtime`
- Remove `log.Lshortfile` from logger initialization
- Add `logWithCallerf` method to include caller information in formatted log messages
- Add `logWithCaller` method to include caller information in log messages
- Update `Errorf` method to use `logWithCallerf` for logging
- Update `Fatalf` method to use `logWithCallerf` for logging and ensure program exit
- Update `Error` method to use `logWithCaller` for logging
- Update `Fatal` method to use `logWithCaller` for logging and ensure program exit
Signed-off-by: appleboy <[email protected]>1 parent 811fe1a commit 602ca74
1 file changed
+30
-7
lines changed| 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 | | |
22 | | - | |
23 | | - | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
38 | 60 | | |
39 | | - | |
| 61 | + | |
40 | 62 | | |
41 | 63 | | |
42 | 64 | | |
43 | | - | |
| 65 | + | |
| 66 | + | |
44 | 67 | | |
45 | 68 | | |
46 | 69 | | |
47 | 70 | | |
48 | 71 | | |
49 | 72 | | |
50 | 73 | | |
51 | | - | |
| 74 | + | |
52 | 75 | | |
53 | 76 | | |
54 | 77 | | |
55 | | - | |
| 78 | + | |
56 | 79 | | |
57 | 80 | | |
58 | 81 | | |
| |||
0 commit comments