vube / monolog-splunk-formatter
Splunk Line Formatter for Monolog
Installs: 428 307
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 5
Forks: 7
Open Issues: 2
Requires
- php: >=5.3.0
Requires (Dev)
- monolog/monolog: ~1.0
- phpunit/phpunit: ~4.0
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2024-11-09 17:35:27 UTC
README
A Splunk Formatter for Monolog
About
vube/monolog-splunk-formatter
is a formatter for use with Monolog.
It augments the Monolog LineFormatter
by adding Splunk-optimized handling of associative array contexts.
Prerequisites/Requirements
- PHP 5.3.0 or greater
- Composer
Installation
Installation is possible using Composer
composer require vube/monolog-splunk-formatter ~1.0
Usage
Create an instance of \Vube\Monolog\Formatter\SplunkLineFormatter
and set it as the formatter for the \Monolog\Handler\StreamHandler
that you use with your \Monolog\Logger
instance.
use \Monolog\Logger;
use \Monolog\Handler\StreamHandler;
use \Vube\Monolog\Formatter\SplunkLineFormatter;
$log = new Logger('DEMO');
$handler = new StreamHandler('php://stdout', Logger::WARNING);
$handler->setFormatter(new SplunkLineFormatter());
$log->pushHandler($handler);
$log->addError('Bad stuff happened', array('detail1' => 'something', 'detail2' => 'otherthing'));
Unit Testing
vube/monolog-splunk-formatter
ships with unit tests using PHPUnit.
-
If PHPUnit is installed globally run
phpunit
to run the tests. -
If PHPUnit is not installed globally, install it locally through composer by running
composer install --dev
. Run the tests themselves by callingvendor/bin/phpunit
.
Unit tests are also automatically run on Travis CI
License
vube/monolog-splunk-formatter
is released under the MIT public license. See the enclosed LICENSE
for details.
Thanks
Thanks to Bramus for contributing a Monolog formatter, I was inspired by and reused some of his work.