PluginProbe
Media Cloud Sync / 1.0.2
Media Cloud Sync v1.0.2
1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 35 releases
media-cloud-sync / includes / sdk / google / psr / log / README.md

README.md in Media Cloud Sync 1.0.2, at includes/sdk/google/psr/log/README.md

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