2017 © Pedro Peláez
 

library inline-logger

Stdout your logs directly!

image

yoannrenard/inline-logger

Stdout your logs directly!

  • Monday, February 13, 2017
  • by yoannrenard
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

inline-logger

Stdout your logs directly!, (*1)

Installation

Use Composer and run :, (*2)

$> composer require yoannrenard/inline-logger

Requirements

Example

use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

class RandomClass
{
    /** @var LoggerInterface */
    protected $logger;

    /**
     * @param LoggerInterface $logger
     */
    public function __construct(LoggerInterface $logger = null)
    {
        $this->logger = $logger ?: new NullLogger();
    }

    public function randomMethod()
    {
        $this->logger->info('My random log');
    }
}

A proper LoggerInterface should always be injected into the RandomClass class when running in production., (*3)

But imagine you wanna, for some reason, play with it in a dummy command line, without Monolog, without anything J, (*4)

$randomClass = new RandomClass(new InlineLogger());
$randomClass->randomMethod();

This dummy InlineLogger class will print in your stdout all your beloved logs, (*5)

[2017-02-13 16:07:30] php.INFO: My random log

The Versions

13/02 2017

dev-master

9999999-dev

Stdout your logs directly!

  Sources   Download

MIT

The Requires

 

by Yoann RENARD

13/02 2017

1.0.0

1.0.0.0

Stdout your logs directly!

  Sources   Download

MIT

The Requires

 

by Yoann RENARD