@@ -24,7 +24,7 @@ public function __call($name, $arguments)
24
24
$ name = 'debug ' ;
25
25
}
26
26
27
- return call_user_func_array ([ ' Illuminate\Support\Facades\Log ' , $ name] , $ arguments );
27
+ return self :: __callStatic ( $ name , $ arguments );
28
28
}
29
29
30
30
/**
@@ -35,6 +35,10 @@ public function __call($name, $arguments)
35
35
*/
36
36
public static function __callStatic ($ name , $ arguments )
37
37
{
38
+ if (!in_array ($ name , self ::$ LOG_LEVELS )) {
39
+ $ name = 'debug ' ;
40
+ }
41
+
38
42
if (session_status () == PHP_SESSION_NONE ) {
39
43
$ arguments [1 ]['sid ' ] = session_id ();
40
44
} else {
@@ -52,6 +56,7 @@ public static function __callStatic($name, $arguments)
52
56
$ trackIdKey = env ('XLOG_TRACK_ID_KEY ' , 'xTrackId ' );
53
57
54
58
// get request track ID from service container
59
+
55
60
if (!isset ($ arguments [1 ][$ trackIdKey ])) {
56
61
$ arguments [1 ][$ trackIdKey ] = self ::getTrackId ($ trackIdKey );
57
62
}
@@ -65,20 +70,20 @@ public static function __callStatic($name, $arguments)
65
70
*
66
71
* @return mixed
67
72
*/
68
- public static function exception (Exception $ e , $ level = 'error ' )
73
+ public static function exception (Exception $ e , $ name = 'error ' )
69
74
{
70
75
$ trackIdKey = env ('XLOG_TRACK_ID_KEY ' , 'xTrackId ' );
71
76
72
77
$ arguments = [];
73
78
$ arguments [0 ] = 'exception ' . $ e ->getMessage ();
74
79
$ arguments [1 ] = [
75
- 'code ' => $ e ->getCode (),
76
- 'file ' => basename ($ e ->getFile ()),
77
- 'line ' => $ e ->getLine (),
78
- $ trackIdKey => self ::getTrackId ($ trackIdKey )
80
+ 'code ' => $ e ->getCode (),
81
+ 'file ' => basename ($ e ->getFile ()),
82
+ 'line ' => $ e ->getLine (),
83
+ $ trackIdKey => self ::getTrackId ($ trackIdKey ),
79
84
];
80
85
81
- return call_user_func_array ([ ' Tartan\Log\Logger ' , $ level ] , $ arguments );
86
+ return self :: __callStatic ( $ name , $ arguments );
82
87
}
83
88
84
89
/**
@@ -93,6 +98,8 @@ protected static function getTrackId($trackIdKey)
93
98
} catch (Exception $ e ) {
94
99
$ trackId = '- ' ;
95
100
}
101
+
96
102
return $ trackId ;
97
103
}
104
+
98
105
}
0 commit comments