PHP code example of avengers-code-lovers / laravel-log-monitoring

1. Go to this page and download the library: Download avengers-code-lovers/laravel-log-monitoring 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/ */

    

avengers-code-lovers / laravel-log-monitoring example snippets


'providers' => [
    // Other service providers...

    AvengersGroup\MonitoringServiceProvider::class

],

protected $middleware => [
    // Other global middleware...

    \Illuminate\Session\Middleware\StartSession::class,
];

protected $middlewareGroups => [
    'web' => [
        \App\Http\Middleware\EncryptCookies::class,
        \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
        //\Illuminate\Session\Middleware\StartSession::class,       // Comment this
        // ...
    ],
];

    'chatwork' => [
        'api_key' => env('CHATWORK_API_KEY'),
        'room_id_sos' => env('CHATWORK_API_ROOM_ID'),
        'role' => [
            'admin' => 'admin'
        ]
    ]

public function report(Exception $exception)
{
    app('monitoring')->sendExceptionToChatWork($exception);

    parent::report($exception);
}

/**
 * The job failed to process.
 *
 * @param  Exception  $exception
 * @return void
 */
public function failed(Exception $exception)
{
    app('monitoring')->sendExceptionToChatWork($exception);
}

/**
 * Render an exception into an HTTP response.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Exception  $exception
 * @return \Illuminate\Http\Response
 */
public function render($request, Exception $exception)
{
    app('monitoring')->sendExceptionToChatWork($exception, $request);

    return parent::render($request, $exception);
}