Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.coveralls.yml
.gitattributes
.gitignore
.travis.yml
LICENSE
README.md
composer.json
phpunit.xml

README.md

The pool of different loggers wich impliments \PSR\Log\LoggerInterface

Latest Stable Version License Build Status Coverage Status

Installation

The preferred way to install this extension is through composer and then run

composer require elementary/logger-pool

Usage

use elementary\logger\pool\LoggerPool;
use elementary\logger\traits\LoggerGetInterface;
use elementary\logger\traits\LoggerTrait;
use elementary\logger\graylog\udp\GraylogUdp;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\NullLogger;

class Example implements LoggerGetInterface, LoggerAwareInterface
{
    use LoggerTrait;

    public function doSomeThing()
    {
        // Do some thing
        $this->getLogger()->debug('do some thing');
        
        // Runtime error should be logged and monitored
        $this->getLogger()->error('Attantion! The error was happened!');
    }
}

LoggerPool::me()->setLogger(new NullLogger());
LoggerPool::me()->setLogger(new GraylogUdp('test', 'localhost', 12201), 'warning');

$ex = new Example();
$ex->setLogger(LoggerPool::me());
$ex->doSomeThing();

Testing and Code coverage

Unit Tests are located in tests directory. You can run your tests and collect coverage with the following command:

vendor/bin/phpunit

Result of coverage will be output into the tests/output directory.

License

For license information check the LICENSE-file.

You can’t perform that action at this time.