hxd/query-logger

This is a package that saves all database queries to a log file with some customizations

v1.0.5 2024-10-04 12:39 UTC

This package is auto-updated.

Last update: 2024-12-04 13:03:16 UTC


README

Latest Version on Packagist Total Downloads

This is a package that saves all database queries to a log file with some customizations

Installation

You can install the package via composer:

composer require hxd/query-logger

Usage

You can publish the config file with:

php artisan vendor:publish --tag="query-logger-config"

This is the contents of the published config file:

return [
    // Enable or disable query logger
    'enabled' => env('QUERY_LOGGER_ENABLED', true),

    // Enable or disable query logger for specific connection
    'enable_for_connection' => env('QUERY_LOGGER_ENABLE_FOR_CONNECTION', null),

    // Channel you want to save query into (must have in laravel logging channel config)
    'channel' => env('QUERY_LOGGER_LOG_CHANNEL', 'stack'),

    // Enable or Disable automatically assign values to the query,
    // by default the queries will be hidden values to ensure security.
    // Make sure you know what you're doing when you turn this on
    'enable_map_value' => env('QUERY_LOGGER_ENABLE_MAP_VALUE', true),

    // Log query execute time
    'log_execute_time' => env('QUERY_LOGGER_LOG_EXEC_TIME', true),

    // Look at the name, you know, the threshold to assign "SLOW QUERY" before your query in the log
    'slow_query_threshold' => env('QUERY_LOGGER_SLOW_QUERY_THRESHOLD', 0),

	// Log query execute path
	'log_execute_path' => env('QUERY_LOGGER_LOG_EXEC_PATH', true),

    // Log connetions
    'log_connections' => explode(',', env('QUERY_LOGGER_LOG_CONNECTIONS', '')),
];

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email me@hxd.vn instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.