Lychee icon indicating copy to clipboard operation
Lychee copied to clipboard

Do not log queries which are faster than 100ms by default

Open ildyria opened this issue 6 months ago • 1 comments

So we can focus on the slow queries.

This pull request introduces a feature to filter SQL query logging based on execution time, enhancing the application's debugging capabilities while reducing unnecessary log noise. The changes include adding a configuration option for a minimum query execution time and updating the logging logic accordingly.

Enhancements to SQL query logging:

  • app/Providers/AppServiceProvider.php: Updated the logSQL method to skip logging SQL queries that execute faster than the configured minimum time (log_sql_min_time). This prevents logging insignificant queries.

  • config/database.php: Added a new configuration option, log_sql_min_time, which allows setting a minimum execution time (in milliseconds) for SQL queries to be logged. This provides more control over the volume of logged queries.

ildyria avatar Jun 11 '25 08:06 ildyria

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 86.38%. Comparing base (51f335c) to head (ffcb421). Report is 37 commits behind head on master.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jun 11 '25 08:06 codecov[bot]