PHP code example of outsourced / log-monolog

1. Go to this page and download the library: Download outsourced/log-monolog 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/ */

    

outsourced / log-monolog example snippets


use Monolog\Logger;
use LogOutsourcedMonolog\LogOutsourcedHandler;

$logger = new Logger('name');
$logger->pushHandler(new LogOutsourcedHandler('https://uri.to/your_log/outsourced_api'));

[
    'channels' => [
        'outsourced' => [
            'driver'  => 'monolog',
            'handler' => LogOutsourcedMonolog\LogOutsourcedHandler::class,
            'with' => [
                'host' => env('OUTSOURCED_HOST', 'https://outsourced.example.com'),
                'accessKey' => env('OUTSOURCED_ACCESS_KEY', 'access-key')
            ],
        ]
    ]
]