@@ -36,7 +36,7 @@ public static function exception(Exception $e, bool $trace = false, string $name
36
36
'code ' => $ e ->getCode (),
37
37
'file ' => basename ($ e ->getFile ()),
38
38
'line ' => $ e ->getLine (),
39
- self :: getTrackIdKey () => self :: getTrackId () ,
39
+ ' x_track_id ' => REQUEST_TRACKING_ID ,
40
40
];
41
41
42
42
if ($ trace ) {
@@ -46,29 +46,6 @@ public static function exception(Exception $e, bool $trace = false, string $name
46
46
return self ::__callStatic ($ name , $ arguments );
47
47
}
48
48
49
- /**
50
- * @return string
51
- */
52
- public static function getTrackIdKey (): string
53
- {
54
- return env ('XLOG_TRACK_ID_KEY ' , 'xTrackId ' );
55
- }
56
-
57
- /**
58
- * @return string
59
- */
60
- protected static function getTrackId (): string
61
- {
62
- $ trackIdKey = self ::getTrackIdKey ();
63
-
64
- try {
65
- $ trackId = resolve ($ trackIdKey );
66
- } catch (Exception $ e ) {
67
- $ trackId = '- ' ;
68
- }
69
-
70
- return $ trackId ;
71
- }
72
49
73
50
/**
74
51
* @param $name
@@ -95,31 +72,20 @@ public static function __callStatic($name, $arguments)
95
72
$ arguments [1 ] = [$ arguments [1 ]];
96
73
}
97
74
98
- $ arguments [1 ]['sid ' ] = self ::getSessionId ();
99
-
100
75
$ arguments [1 ]['uip ' ] = @clientIp ();
101
76
102
77
// add user id to all logs
103
78
$ arguments [1 ]['uid ' ] = self ::getUserTag (); // user id as a tag
104
79
105
- // get request track ID from service container
106
- $ trackIdKey = self ::getTrackIdKey ();
107
- if (!isset ($ arguments [1 ][$ trackIdKey ])) {
108
- $ arguments [1 ][$ trackIdKey ] = self ::getTrackId ($ trackIdKey );
80
+ if (session_status () === PHP_SESSION_ACTIVE ) {
81
+ $ arguments [1 ]['sid ' ] = session_id ();
109
82
}
110
83
111
- return call_user_func_array ([ ' Illuminate\Support\Facades\Log ' , $ name ], $ arguments );
112
- }
84
+ // get request track ID from service container
85
+ $ arguments [ 1 ][ ' x_track_id ' ] = REQUEST_TRACKING_ID ;
113
86
114
- /**
115
- * @return string
116
- */
117
- private static function getSessionId (): string
118
- {
119
- if (session_status () === PHP_SESSION_ACTIVE ) {
120
- return session_id ();
121
- }
122
- return '' ;
87
+
88
+ return call_user_func_array (['Illuminate\Support\Facades\Log ' , $ name ], $ arguments );
123
89
}
124
90
125
91
/**
0 commit comments