PHP code example of exolnet / wp-graylog

1. Go to this page and download the library: Download exolnet/wp-graylog 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/ */

    

exolnet / wp-graylog example snippets


/**
 * wp-graylog
 *
 * Here you may configure the Graylog channel for your application. Behind the
 * scene, it uses the Monolog PHP logging library.
 */
Config::define('GRAYLOG_TRANSPORT', env('GRAYLOG_TRANSPORT'));
Config::define('GRAYLOG_HOST', env('GRAYLOG_HOST'));
Config::define('GRAYLOG_PORT', env('GRAYLOG_PORT'));
Config::define('GRAYLOG_LEVEL', env('GRAYLOG_LEVEL'));

Config::define('GRAYLOG_PATH', env('GRAYLOG_PATH', '/gelf'));

Config::define('GRAYLOG_APP', 'custom-app-name');

Config::define('GRAYLOG_INITIALIZE_ERROR_HANDLER', false);

try {
    $this->functionFailsForSure();
} catch (\Throwable $exception) {
    \Exolnet\Wordpress\Graylog\WpGraylog::captureException($exception);
}

// OR

\Exolnet\Wordpress\Graylog\WpGraylog::captureLastError();