PHP code example of troopers / metrics-bundle

1. Go to this page and download the library: Download troopers/metrics-bundle 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/ */

    

troopers / metrics-bundle example snippets


class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            ...
            new Troopers\MetricsBundle\MetricsBundle(),
            ...
        );

        return $bundles

$logger->info('a log with some context object', [
    new SerializeContextItem($someObject, ['serializingGroupLambda'], 'myalias'),
    'a_different_simple_context_prop' => 42,
    new SerializeContextItem($anotherOne, ['serializingGroup1', 'serializingGroup2']),
]);

$logger->info('a test in the past', ['@datetime' => new \DateTime('10 days ago')]);