PHP code example of stackify / logger

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

    

stackify / logger example snippets


use Stackify\Log\Standalone\Logger;

$logger = new Logger('application_name', 'environment_name');

use Stackify\Log\Transport\ExecTransport;
use Stackify\Log\Standalone\Logger;
    
$transport = new ExecTransport('api_key');
$logger = new Logger('application_name', 'environment_name', $transport);

$transport = new ExecTransport($apiKey, ['proxy' => 'https://55.88.22.11:3128']);

$transport = new ExecTransport($apiKey, ['curlPath' => '/usr/bin/curl']);

$logger = new Logger('application_name', 'environment_name', $transport, true);

        $config = array(
                'CapturePostVariables' => true,
                'CaptureRawPostData' => true,
                ...
        );
        

$config = array(
        'CaptureServerVariables' => false,
        'CaptureServerVariablesWhitelist' => '*',
        'CaptureServerVariablesBlacklist' => 'REMOTE_ADDR,SERVER_ADDR',
        ...
    );

$logger = new Logger('application_name', 'environment_name', $transport, true, $config);

$config = array(
        'CaptureServerVariables' => false,
        'CaptureServerVariablesWhitelist' => '*',
        'CaptureServerVariablesBlacklist' => 'REMOTE_ADDR,SERVER_ADDR',
        ...
    );

$transport = new ExecTransport($apiKey, [
    'config' => $config
]);

$transport = new ExecTransport($apiKey, ['debug' => true]);

$config = array(
        'DebugLogPath' => '/path/to/log.log',
        'Debug' => true
    );

$logger = new Logger('application_name', 'environment_name', $transport, true, $config);

/** Requires composer **/
$applicationName = 'Your Application Name';
$environment = 'YourEnvironment';
$rumKey = 'YourRumKey';
 
\Stackify\Utils\Rum::getInstance()->setupConfiguration(
	$applicationName,
	$environment,
	$rumKey
);

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	 echo \Stackify\Utils\Rum::getInstance()->insertRumScript();