PHP code example of nohponex / monolog-datadog-handler

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

    

nohponex / monolog-datadog-handler example snippets




use Nohponex\MonologDataDogHandler\DataDogHandler;

$tag = [
    sprintf(
        'environment:%s',
        'ci'
    ),
    sprintf(
        'instance:%s',
        'api'
    )
];

$log = new Logger('name');
$log->pushHandler(
    new DataDogHandler(
        'xxxx',
        'yyy',
        $tag,
        \Monolog\Logger::INFO
    )
);