PHP code example of sroze / log-stream

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

    

sroze / log-stream example snippets


use GuzzleHttp\Client;
use LogStream\Client\Http\JsonSerializableNormalizer;
use LogStream\Client\HttpClient;
use LogStream\TreeLoggerFactory;

$loggerFactory = new TreeLoggerFactory(
    new HttpClient(
        new Client(),
        new JsonSerializableNormalizer(),
        $address
    )
);

$bundles = [
    // ...
    new LogStream\LogStreamBundle(),
];

use LogStream\Client\FaultTolerance\OperationRunnerDecorator;

use FaultTolerance\OperationRunner\SimpleOperationRunner;
use FaultTolerance\OperationRunner\RetryOperationRunner;
use FaultTolerance\Waiter\SleepWaiter;
use FaultTolerance\WaitStrategy\Exponential;

$runner = new RetryOperationRunner(
    new SimpleOperationRunner(),
    new Max(new Exponential(new SleepWaiter(), 0.1), 10)
);

$client = new OperationRunnerDecorator($client, $operationRunner);