oz-sysb / fluent-logger
fluent-log ライブラリ
Installs: 50 233
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 25
Forks: 0
Open Issues: 2
Requires
- fluent/logger: ^1.0
Requires (Dev)
- php-coveralls/php-coveralls: ^1.1 || ^2.2
- phpunit/phpunit: ^4.8 || ^6.0
- phpunit/phpunit-skeleton-generator: ^2.0
This package is auto-updated.
Last update: 2024-10-25 08:56:13 UTC
README
Requirements
- PHP 5.3 or higher
Installation
Library is available on Packagist.
It's recommended that you use Composer to install oz-sysb/fluent-logger.
$ composer require oz-sysb/fluent-logger
Usage
PHP side
<?php require_once __DIR__.'/vendor/autoload.php'; use \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 required part $type = 'api-client'; $logger->info($type, 'Post to https://example.com/api/member, and post params id=100&key=value', __FUNCTION__, __CLASS__); $logger->info($type, 'Response from https://example.com/api/member response body is {"status": "successed!"}', __FUNCTION__, __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__);
Fluentd side
Use in_forward
.
<source> @type forward </source>
License
MIT