Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/updraftp.../vendor/psr/log
File: README.md
PSR Log
[0] Fix | Delete
=======
[1] Fix | Delete
[2] Fix | Delete
This repository holds all interfaces/classes/traits related to
[3] Fix | Delete
[PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md).
[4] Fix | Delete
[5] Fix | Delete
Note that this is not a logger of its own. It is merely an interface that
[6] Fix | Delete
describes a logger. See the specification for more details.
[7] Fix | Delete
[8] Fix | Delete
Installation
[9] Fix | Delete
------------
[10] Fix | Delete
[11] Fix | Delete
```bash
[12] Fix | Delete
composer require psr/log
[13] Fix | Delete
```
[14] Fix | Delete
[15] Fix | Delete
Usage
[16] Fix | Delete
-----
[17] Fix | Delete
[18] Fix | Delete
If you need a logger, you can use the interface like this:
[19] Fix | Delete
[20] Fix | Delete
```php
[21] Fix | Delete
<?php
[22] Fix | Delete
[23] Fix | Delete
use Psr\Log\LoggerInterface;
[24] Fix | Delete
[25] Fix | Delete
class Foo
[26] Fix | Delete
{
[27] Fix | Delete
private $logger;
[28] Fix | Delete
[29] Fix | Delete
public function __construct(LoggerInterface $logger = null)
[30] Fix | Delete
{
[31] Fix | Delete
$this->logger = $logger;
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
public function doSomething()
[35] Fix | Delete
{
[36] Fix | Delete
if ($this->logger) {
[37] Fix | Delete
$this->logger->info('Doing work');
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
try {
[41] Fix | Delete
$this->doSomethingElse();
[42] Fix | Delete
} catch (Exception $exception) {
[43] Fix | Delete
$this->logger->error('Oh no!', array('exception' => $exception));
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
// do something useful
[47] Fix | Delete
}
[48] Fix | Delete
}
[49] Fix | Delete
```
[50] Fix | Delete
[51] Fix | Delete
You can then pick one of the implementations of the interface to get a logger.
[52] Fix | Delete
[53] Fix | Delete
If you want to implement the interface, you can require this package and
[54] Fix | Delete
implement `Psr\Log\LoggerInterface` in your code. Please read the
[55] Fix | Delete
[specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
[56] Fix | Delete
for details.
[57] Fix | Delete
[58] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function