PHP code example of dakatsuka / monolog-fluent-handler

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

    

dakatsuka / monolog-fluent-handler example snippets



use Dakatsuka\MonologFluentHandler\FluentHandler;
use Monolog\Logger;

$logger = new Logger('dakatsuka');
$logger->pushHandler(new FluentHandler());

$logger->debug('example.monolog', array('foo' => 'bar'));
$logger->info('example.fluentd', array('fizz' => 'buzz'));

// Fluentd:
// 2013-10-11 01:00:00 +0900 dakatsuka.example.monolog: {"foo":"bar","level":"DEBUG"}
// 2013-10-11 01:00:00 +0900 dakatsuka.example.fluentd: {"fizz":"buzz","level":"INFO"}


$logger = new Logger('dakatsuka');
$logger->pushHandler(new FluentHandler(null, '127.0.0.1', 24224));


$fluent = new FluentLogger("localhost", 24224);
$logger = new Logger('dakatsuka');
$logger->pushHandler(new FluentHandler($fluent));
bash
$ php composer.phar install