Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extention of \Psr\Log\LoggerAwareTrait

The trait LogerTrait extends LoggerAwareTrait with one method getLoger().

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-trait

Usage

use elementary\logger\traits\LoggerGetInterface;
use elementary\logger\traits\LoggerTrait;
use Psr\Log\LoggerAwareInterface;

class Example implements LoggerGetInterface, LoggerAwareInterface
{
    use LoggerTrait;

    public function doSomeThing()
    {
        // do some thing
        $this->getLogger()->info('do some thing');
    }
}

$ex = new Example();

// In this case, the message will be sent to `\Psr\Log\NullLogger`
$ex->doSomeThing();

// Now message will be send to Graylog
$ex->setLogger(new \Gelf\Logger($publisher, $facility));
$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.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages