PHP code example of oz-sysb / fluent-logger

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

    

oz-sysb / fluent-logger example snippets




Fluent\Logger\FluentLogger as Client;
use \OzSysb\Logger\OzLogger;

// Always define first
OzLogger::setApplication('woodstock');
// init class.
$logger = new OzLogger(new Client('unix:///var/run/td-agent/td-agent.sock'));

// ... snip ...

// Describe every ON__, __CLASS__);


// ... snip ...
$type = 'db';
$logger->info($type, "DB Insert : inserts member_id=100 to super1 table", __FUNCTION__, __CLASS__);
$type = 'db';
$logger->error($type, "DB Error : ERROR 1099 (HY000): Table 'super1' was locked with a READ lock and can't be updted", __FUNCTION__, __CLASS__);
aconf
<source>
  @type forward
</source>