ageekdev/vapor-http-logger

此包可以将Laravel Vapor应用程序的入站请求记录到云监控中。

v1.1.0 2024-04-07 14:25 UTC

This package is auto-updated.

Last update: 2024-09-07 15:23:10 UTC


README

Latest Version on Packagist Laravel 9.x Laravel 10.x Laravel 11.x GitHub Tests Action Status Total Downloads

在Laravel Vapor应用程序中记录HTTP请求

安装

您可以通过composer安装此包

composer require ageekdev/vapor-http-logger

您可以使用以下命令发布配置文件

php artisan vendor:publish --provider="AgeekDev\HttpLogger\HttpLoggerServiceProvider" --tag="config"

这是发布配置文件的内容

return [
    /*
     *  Automatic registration of middleware will only happen if this setting is `true`
     */
    'enabled' => env('HTTP_LOGGER_ENABLED', true),

    /*
     * The log profile which determines whether a request should be logged.
     * It should implement `LogProfile`.
     */
    'log_profile' => \AgeekDev\HttpLogger\LogNonGetRequests::class,

    /*
     * The log writer used to write the request to a log.
     * It should implement `LogWriter`.
     */
    'log_writer' => \AgeekDev\HttpLogger\DefaultLogWriter::class,

    /*
     * The log channel used to write the request.
     */
    'log_channel' => env('LOG_CHANNEL', 'stderr'),

    /*
     * The log level used to log the request.
     */
    'log_level' => 'info',

    /*
     * List of request methods that will be logged.
     */
    'request_methods' => ['post', 'put', 'patch', 'delete'],

    /*
     * Filter out body fields which will never be logged.
     */
    'except' => [
        'password',
        'password_confirmation',
    ],

    /*
     * List of headers that will be sanitized. For example Authorization, Cookie, Set-Cookie...
     */
    'sanitize_headers' => [],
];

测试

composer test

变更日志

有关最近更改的更多信息,请参阅 CHANGELOG

贡献

有关详细信息,请参阅 CONTRIBUTING

安全漏洞

请查看 我们的安全策略 了解如何报告安全漏洞。

鸣谢

此包包含从 Log HTTP requests 复制的代码

许可协议

MIT许可协议(MIT)。有关更多信息,请参阅 许可文件