Skip to content

Commit 6d72a4d

Browse files
committed
代码优化
1 parent be0c22f commit 6d72a4d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/SQLTraceServiceProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function boot(): void
2020
}
2121

2222
$isOpenListen = config('sql_trace.open_listen_sql');
23-
$sqlLogPath = config('sql_trace.sql_log_path', storage_path('/logs/'));
23+
$sqlLogPath = config('sql_trace.sql_log_path') ?: storage_path('/logs/');
2424

2525
if ($isOpenListen) {
2626
$traceId = $_REQUEST['trace_id'] ?? uniqid(bin2hex(random_bytes(10)),true);
@@ -51,7 +51,7 @@ public function boot(): void
5151
unset($dbConf['password']);
5252
}
5353

54-
$logPath = $sqlLogPath . '.sql_trace.' . now()->toDateString() . '.log';
54+
$logPath = $sqlLogPath . 'sql-trace-' . now()->toDateString() . '.log';
5555

5656
file_put_contents($logPath,json_encode([
5757
'level' => $this->getSqlLevelByExecTime($sql->time),
@@ -79,7 +79,7 @@ public function boot(): void
7979
*/
8080
public function register(): void
8181
{
82-
$this->mergeConfigFrom(__DIR__.'/../config/sql_trace.php', 'sqlTrace');
82+
$this->mergeConfigFrom(__DIR__.'/../config/sql_trace.php', 'sql_trace');
8383
}
8484

8585
/**

0 commit comments

Comments
 (0)