PHP code example of benq / laravel_http_logger

1. Go to this page and download the library: Download benq/laravel_http_logger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

benq / laravel_http_logger example snippets



return [
    /*
     * false - don't log body fields
     * ['only'] - log fields only
     * ['except'] - don't log fields
     *
     * If ['only'] is set, ['except'] parameter will be omitted
     */
    // 'content' => false,
    'content' => [
        'only' => [],
        'except' => ['password'],
    ],

    /*
     * false - don't log headers
     * ['only'] - log headers only
     * ['except'] - don't log headers
     *
     * If ['only'] is set, ['except'] parameter will be omitted
     */
    // 'headers' => false,
    'headers' => [
        'only' => [],
        'except' => [],
    ],

    /*
     * false - don't log response
     * ['only'] - log response only
     * ['except'] - don't log response
     *
     * If ['only'] is set, ['except'] parameter will be omitted
     */
    // 'response' => false,
    'response' => [
        'only' => [],
        'except' => [],
    ],

    /*
     * false - don't limit response
     * limit - response message limit
     *
     */
    // 'response-limit' => false,
    'response-limit' => 10000
];


return [
    'channels' => [
        'stack' => [
            'driver' => 'stack',
            'channels' => ['single'],
            'ignore_exceptions' => false,
        ],

        'single' => [
            'driver' => 'single',
            'path' => storage_path('logs/laravel.log'),
            'level' => 'debug',
        ],

        'stdout' => [
            'driver' => 'monolog',
            'handler' => StreamHandler::class,
            'with' => [
                'stream' => 'php://stdout',
            ],
            'formatter' => Benq\Logger\Formatter\JsonFormatter,
            'formatter_with' => [
                'setMaxNormalizeDepth' => 2
            ],
            'level' => 'debug',
        ],

bash
php artisan vendor:publish --provider="Benq\Logger\Providers\LoggerServiceProvider"