Skip to content

Commit 03378b0

Browse files
committed
fixed the way of getting track id key
1 parent 23d65b6 commit 03378b0

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/Logger.php

+16-8
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static function __callStatic($name, $arguments)
4040
}
4141

4242
if (!is_array($arguments)) {
43-
$arguments= [$arguments];
43+
$arguments = [$arguments];
4444
}
4545

4646
if (isset($arguments[1])) {
@@ -80,27 +80,35 @@ public static function __callStatic($name, $arguments)
8080
*/
8181
public static function exception(Exception $e, $name = 'error')
8282
{
83-
$trackIdKey = env('XLOG_TRACK_ID_KEY', 'xTrackId');
84-
8583
$arguments = [];
8684
$arguments [0] = 'exception-> ' . $e->getMessage();
8785
$arguments [1] = [
88-
'code' => $e->getCode(),
89-
'file' => basename($e->getFile()),
90-
'line' => $e->getLine(),
91-
$trackIdKey => self::getTrackId($trackIdKey),
86+
'code' => $e->getCode(),
87+
'file' => basename($e->getFile()),
88+
'line' => $e->getLine(),
89+
self::getTrackIdKey() => self::getTrackId(),
9290
];
9391

9492
return self::__callStatic($name, $arguments);
9593
}
9694

95+
/**
96+
* @return string
97+
*/
98+
public static function getTrackIdKey()
99+
{
100+
return env('XLOG_TRACK_ID_KEY', 'xTrackId');
101+
}
102+
97103
/**
98104
* @param $trackIdKey
99105
*
100106
* @return string
101107
*/
102-
protected static function getTrackId($trackIdKey)
108+
protected static function getTrackId()
103109
{
110+
$trackIdKey = self::getTrackIdKey();
111+
104112
try {
105113
$trackId = resolve($trackIdKey);
106114
} catch (Exception $e) {

0 commit comments

Comments
 (0)