PHP code example of pod-point / laravel-monolog-kinesis

1. Go to this page and download the library: Download pod-point/laravel-monolog-kinesis 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/ */

    

pod-point / laravel-monolog-kinesis example snippets




return [

    // ...

    'kinesis' => [
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
    ],

];



return [

    // ...

    'channels' => [

        'some_channel' => [
            'driver' => 'kinesis',
            'stream' => 'some_stream_name',
            'level' => 'info', // default level is debug
        ],

    ],

];



return [

    // ...

    'channels' => [

        'some_channel' => [
            'driver' => 'kinesis',
            'stream' => env('LOGGING_KINESIS_STREAM'),
            'level' => env('LOG_LEVEL', 'debug'),
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
        ],

    ],

];

logger()->info('This is an info log message', ['foo' => 'bar']);



return [

    // ...

    'channels' => [

        'some_channel' => [
            // ...
            'formatter' => \App\SimplerCustomFormatter::class,
        ],

    ],

];

namespace App;

use Monolog\Formatter\NormalizerFormatter;

class SimplerCustomFormatter extends NormalizerFormatter
{
    public function format(array $record) // here you can customize the formatting
    {
        return [
            'Data' => [
                'level' => $record['level_name'],
                'custom_message' => $record['message'],
            ],
        ];
    }
}

// ...
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'http' => [
    'verify' => false
]