2017 © Pedro Peláez
 

library log

Common interface for logging libraries

image

psr/log

Common interface for logging libraries

  • Tuesday, April 3, 2018
  • by Seldaek
  • Repository
  • 72 Watchers
  • 4180 Stars
  • 121,826,934 Installations
  • PHP
  • 3524 Dependents
  • 93 Suggesters
  • 113 Forks
  • 10 Open issues
  • 4 Versions
  • 8 % Grown

The README.md

PSR Log

This repository holds all interfaces/classes/traits related to PSR-3., (*1)

Note that this is not a logger of its own. It is merely an interface that describes a logger. See the specification for more details., (*2)

Installation

composer require psr/log

Usage

If you need a logger, you can use the interface like this:, (*3)

<?php

use Psr\Log\LoggerInterface;

class Foo
{
    private $logger;

    public function __construct(LoggerInterface $logger = null)
    {
        $this->logger = $logger;
    }

    public function doSomething()
    {
        if ($this->logger) {
            $this->logger->info('Doing work');
        }

        try {
            $this->doSomethingElse();
        } catch (Exception $exception) {
            $this->logger->error('Oh no!', array('exception' => $exception));
        }

        // do something useful
    }
}

You can then pick one of the implementations of the interface to get a logger., (*4)

If you want to implement the interface, you can require this package and implement Psr\Log\LoggerInterface in your code. Please read the specification text for details., (*5)

The Versions

03/04 2018

dev-master

9999999-dev https://github.com/php-fig/log

Common interface for logging libraries

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

psr log psr-3

10/10 2016

1.0.2

1.0.2.0 https://github.com/php-fig/log

Common interface for logging libraries

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

psr log psr-3

19/09 2016

1.0.1

1.0.1.0 https://github.com/php-fig/log

Common interface for logging libraries

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

psr log psr-3

21/12 2012

1.0.0

1.0.0.0

Common interface for logging libraries

  Sources   Download

MIT

psr log psr-3