Skip to content

Commit

Permalink
Merge pull request #35 from iwindy/master
Browse files Browse the repository at this point in the history
增加日志写入通道配置
  • Loading branch information
overtrue authored Aug 12, 2021
2 parents 6de73d1 + 88bd3fe commit 46b546a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ return [
// Only record queries when the QUERY_LOG_TRIGGER is set in the environment,
// or when the trigger HEADER, GET, POST, or COOKIE variable is set.
'trigger' => env('QUERY_LOG_TRIGGER'),

// Log Channel
'channel' => 'stack',
],
];
```
Expand Down
3 changes: 2 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public function boot()
if (count($bindings) > 0) {
$realSql = vsprintf($sqlWithPlaceholders, array_map([$pdo, 'quote'], $bindings));
}
Log::debug(sprintf('[%s] [%s] %s | %s: %s', $query->connection->getDatabaseName(), $duration, $realSql,
Log::channel(config('logging.query.channel', config('logging.default')))
->debug(sprintf('[%s] [%s] %s | %s: %s', $query->connection->getDatabaseName(), $duration, $realSql,
request()->method(), request()->getRequestUri()));
});
}
Expand Down

0 comments on commit 46b546a

Please sign in to comment.