PHP code example of simple-as-fuck / php-performance-log

1. Go to this page and download the library: Download simple-as-fuck/php-performance-log 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/ */

    

simple-as-fuck / php-performance-log example snippets


/** @var \SimpleAsFuck\PerformanceLog\Service\PerformanceLogConfig $performanceLogConfig */

$sqlThreshold = $performanceLogConfig->setSlowSqlQueryThreshold(null);
$transactionThreshold = $performanceLogConfig->setSlowDbTransactionThreshold(null);

// run some slow queries without annoying performance log

$sqlThreshold->restore();
$transactionThreshold->restore();

/** @var \SimpleAsFuck\PerformanceLog\Service\PerformanceLogConfig $performanceLogConfig */

$performanceLogConfig->setSlowRequestThreshold(null);

// run some extra slow logic without annoying performance log

// no need for threshold restoring, performance listener will handle it

/** @var \SimpleAsFuck\PerformanceLog\Service\PerformanceLogConfig $performanceLogConfig */

$performanceLogConfig->setSlowCommandThreshold(60); // one minute

// run some measured logic

// no need for threshold restoring, performance listener will handle it

/** @var \SimpleAsFuck\PerformanceLog\Service\PerformanceLogConfig $performanceLogConfig */

$performanceLogConfig->setSlowJobThreshold(10000); // 10 seconds

// run some measured logic

// no need for threshold restoring, performance listener will handle it