1. Go to this page and download the library: Download tokenly/fluentd-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/ */
$fluent_logger = new \Tokenly\FluentdLogger\FluentLogger($host, $port);
# set a tag prefix
$app_code = 'myapp';
$environment = 'production';
$tag = 'applog.'.$app_code.'.'.$environment;
# set up monolog
$monolog->pushHandler(new \Tokenly\FluentdLogger\FluentMonologHandler($fluent_logger, $tag));
# set up fluent event logger for measurements
$measurement_logger = new \Tokenly\FluentdLogger\FluentEventLogger($fluent_logger, 'measure.'.$app_code.'.'.$environment);
# Or, instead of the above, set up fluent using fluent bit event logger for measurements
# $measurement_logger = new \Tokenly\FluentdLogger\FluentEventLogger($fluent_logger, 'measure.'.$app_code.'.'.$environment, [], new \Tokenly\FluentdLogger\Packer\FluentBitJsonPacker());
# use monolog
$monolog->info("hi world");
# use measurements
$measurement_logger->log('widget.created', ['widgets' => 4], ['username' => 'leroy']);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.