Skip to content

Commit

Permalink
Changelog + Improved CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbaljet committed Mar 11, 2024
1 parent 542d898 commit 33a30c7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ jobs:
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/pest
run: |
vendor/bin/pest tests/Feature
vendor/bin/pest tests/Unit
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@

- Feature | Dispatch `QueryLogWritten` event after writing queries to the log, so that the whole query log can be accessed for further processing, e.g. generating reports/notifications.
- Feature | Added auth guard to log headers.
- Laravel 11 support
- Laravel 11 support.
- Migrated to Pest for testing (by @pascalbaljet in #2)
- Added GitHub Actions for all supported Laravel and PHP versions.
- Introduced `orchestra/testbench` dev dependency instead of the whole Laravel framework.
- Improved Service Provider: fixed the publish tag and use the regular base `ServiceProvider`.
- Improved `WriterTest` by not mocking the `Config` class but using the real config values.

## [v1.1.0 (2023-07-16)](https://github.com/onlime/laravel-sql-reporter/compare/v1.0.1...v1.1.0)

Expand Down
8 changes: 0 additions & 8 deletions src/SqlQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,4 @@ public function time(): float
{
return $this->time;
}

/**
* Check if this query should be reported.
*/
public function shouldReport(Config $config): bool
{
return preg_match($config->queriesReportPattern(), $this->rawQuery) === 1;
}
}
10 changes: 9 additions & 1 deletion src/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function writeQuery(SqlQuery $query): bool
}
$logLine = $this->formatter->getLine($query);
$this->writeLine($logLine);
if ($query->shouldReport($this->config)) {
if ($this->shouldReportSqlQuery($query)) {
$this->reportQueries[] = $logLine;
}
$this->loggedQueryCount++;
Expand All @@ -57,6 +57,14 @@ public function writeQuery(SqlQuery $query): bool
return false;
}

/**
* Verify whether query should be reported.
*/
private function shouldReportSqlQuery(SqlQuery $query): bool
{
return preg_match($this->config->queriesReportPattern(), $query->rawQuery()) === 1;
}

/**
* Create directory if it does not exist yet.
*
Expand Down

0 comments on commit 33a30c7

Please sign in to comment.