Skip to content

Commit 5fdcbf0

Browse files
authored
Merge pull request #40 from guanguans/master
2 parents b9fb545 + aca0ed8 commit 5fdcbf0

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,16 @@ return [
3838

3939
// Only record queries that are slower than the following time
4040
// Unit: milliseconds
41-
'slower_than' => 0,
41+
'slower_than' => 0,
4242

4343
// Only record queries when the QUERY_LOG_TRIGGER is set in the environment,
4444
// or when the trigger HEADER, GET, POST, or COOKIE variable is set.
45-
'trigger' => env('QUERY_LOG_TRIGGER'),
45+
'trigger' => env('QUERY_LOG_TRIGGER'),
46+
47+
// Except record queries
48+
'except' => [
49+
// '*_telescope_*',
50+
],
4651

4752
// Log Channel
4853
'channel' => 'stack',

src/ServiceProvider.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ public function boot()
3333
}
3434

3535
$this->app['events']->listen(QueryExecuted::class, function (QueryExecuted $query) {
36-
if ($query->time < $this->app['config']->get('logging.query.slower_than', 0)) {
36+
if (
37+
$query->time < $this->app['config']->get('logging.query.slower_than', 0)
38+
|| str($query->sql)->is($this->app['config']->get('logging.query.except', []))
39+
) {
3740
return;
3841
}
3942

@@ -46,7 +49,7 @@ public function boot()
4649

4750
if (count($bindings) > 0) {
4851
$realSql = vsprintf($sqlWithPlaceholders, array_map(
49-
static fn($binding) => $binding === null ? 'NULL' : $pdo->quote($binding),
52+
static fn ($binding) => $binding === null ? 'NULL' : $pdo->quote($binding),
5053
$bindings
5154
));
5255
}

0 commit comments

Comments
 (0)