php-fig/log


License: MIT

Language: PHP


PSR Log

This repository holds all interfaces/classes/traits related to PSR-3.

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.

Installation

composer require psr/log

Usage

If you need a logger, you can use the interface like this:

<?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');
        }

        // do something useful
    }
}

You can then pick one of the implementations of the interface to get a logger.

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.

Project Statistics

Sourcerank 22
Repository Size 35.2 KB
Stars 5,909
Forks 116
Watchers 69
Open issues disabled
Dependencies 1
Contributors 17
Tags 4
Created
Last updated
Last pushed

Top Contributors See all

Jordi Boggiano Graham Campbell Alessandro Lai Jake Bell Rasmus Schultz Johannes John Bafford Sobit Akhmedov Freek Van der Herten Jan Malte Gerth Chris Johnson Andrew Carter Mponos George Grégoire Pineau Christophe Coevoet Robert Gust‑Bardon

Packages Referencing this Repo

psr/log
Common interface for logging libraries
Latest release 1.1.0 - Updated - 5.91K stars

Recent Tags See all

1.1.0 November 21, 2018
1.0.2 October 10, 2016
1.0.1 September 19, 2016
1.0.0 December 21, 2012

Something wrong with this page? Make a suggestion

Last synced: 2018-11-22 00:33:06 UTC

Login to resync this repository