Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 13-Apr-2023 | - | ||||
Psr/Log/ | H | 13-Apr-2023 | - | 630 | 220 | |
LICENSE | H A D | 12-Apr-2023 | 1.1 KiB | 20 | 16 | |
README.md | H A D | 12-Apr-2023 | 1.1 KiB | 46 | 33 | |
composer.json | H A D | 12-Apr-2023 | 511 | 26 | 25 |
README.md
1PSR Log 2======= 3 4This repository holds all interfaces/classes/traits related to 5[PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md). 6 7Note that this is not a logger of its own. It is merely an interface that 8describes a logger. See the specification for more details. 9 10Usage 11----- 12 13If you need a logger, you can use the interface like this: 14 15```php 16<?php 17 18use Psr\Log\LoggerInterface; 19 20class Foo 21{ 22 private $logger; 23 24 public function __construct(LoggerInterface $logger = null) 25 { 26 $this->logger = $logger; 27 } 28 29 public function doSomething() 30 { 31 if ($this->logger) { 32 $this->logger->info('Doing work'); 33 } 34 35 // do something useful 36 } 37} 38``` 39 40You can then pick one of the implementations of the interface to get a logger. 41 42If you want to implement the interface, you can require this package and 43implement `Psr\Log\LoggerInterface` in your code. Please read the 44[specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) 45for details. 46