2017 © Pedro Peláez
 

library logs

image

arrilot/logs

  • Sunday, July 9, 2017
  • by Arrilot
  • Repository
  • 1 Watchers
  • 2 Stars
  • 129 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 42 % Grown

The README.md

Latest Stable Version Total Downloads Build Status Scrutinizer Quality Score, (*1)

Simple trait that makes any class able to use PSR-3 loggers.

Installation

composer require arrilot/logs, (*2)

Usage

use Arrilot\Logs\Logs;

class Foo
{
    use Logs;

    function bar()
    {
        $this->logger()->error('Error happened in bar!);
        $this->logger()->warning('Warning happened in bar!);
        // etc
    }
}


$foo = new Foo();
$foo->bar(); // Everything is ok, but nothing was logged anywhere because no logger was set.

$foo->setLogger($anyPsr3LoggerHere);
$foo->bar(); // There is a log record in $anyPsr3LoggerHere now.

$foo->setEchoLogger();
$foo->bar(); // An error and a warning are echo'ed to a screen.

// If you are using Monolog\Registry to store loggers, you can simply pass a logger name and the package will grab a logger from the Registry.
$foo->setLogger('application_log');
$foo->bar(); // There is a record in application log.

You can also use Arrilot\Logs\EchoLogger as a separate PSR-3 logger without a trait., (*3)

The Versions

09/07 2017

dev-master

9999999-dev https://github.com/arrilot/logs

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nekrasov Ilya

psr3 logs

08/07 2017

0.1

0.1.0.0 https://github.com/arrilot/logs

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nekrasov Ilya

psr3 logs