psr log

psr log

Language
PHP
Category
3
Version
3.0.0
Authors
PHP-FIG
Description
If you want to find all the interfaces, classes, traits, etc. related to PS-3, this PHP logging library helps you find all those resources with just a few clicks. The library isn’t a logger itself but is an interface that forms a logging system. This PHP logging library comes up with full documentation so that developers can easily work with it.
Install Instructions
composer require psr/log
Usage
<?php
use PsrLogLoggerInterface;
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
}
}
Links