diff options
author | Andrew Dolgov <[email protected]> | 2021-02-26 17:35:58 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-26 17:35:58 +0300 |
commit | cf1ede0ba8c687d9bfadf1c372546657968f1dd8 (patch) | |
tree | 3394cbf3d1cd60d4e1e42f8ef0aa88c4eef368b9 /plugins/af_readability/vendor/psr/log/README.md | |
parent | 1baf8c521785ab4dc8f474fdd772280737c7e254 (diff) |
pull latest readability-php via composer
Diffstat (limited to 'plugins/af_readability/vendor/psr/log/README.md')
-rw-r--r-- | plugins/af_readability/vendor/psr/log/README.md | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/plugins/af_readability/vendor/psr/log/README.md b/plugins/af_readability/vendor/psr/log/README.md new file mode 100644 index 000000000..a9f20c437 --- /dev/null +++ b/plugins/af_readability/vendor/psr/log/README.md @@ -0,0 +1,58 @@ +PSR Log +======= + +This repository holds all interfaces/classes/traits related to +[PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md). + +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 +------------ + +```bash +composer require psr/log +``` + +Usage +----- + +If you need a logger, you can use the interface like this: + +```php +<?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. + +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](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) +for details. |