CaseInsensitiveArray.php
2 years ago
DefaultLogger.php
4 years ago
LoggerInterface.php
4 years ago
ObjectTypes.php
2 years ago
RandomGenerator.php
2 years ago
RequestOptions.php
4 years ago
Set.php
2 years ago
Util.php
4 years ago
DefaultLogger.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Stripe\Util; |
| 4 | |
| 5 | /** |
| 6 | * A very basic implementation of LoggerInterface that has just enough |
| 7 | * functionality that it can be the default for this library. |
| 8 | */ |
| 9 | class DefaultLogger implements LoggerInterface |
| 10 | { |
| 11 | /** @var int */ |
| 12 | public $messageType = 0; |
| 13 | |
| 14 | /** @var null|string */ |
| 15 | public $destination; |
| 16 | |
| 17 | public function error($message, array $context = []) |
| 18 | { |
| 19 | if (\count($context) > 0) { |
| 20 | throw new \Stripe\Exception\BadMethodCallException('DefaultLogger does not currently implement context. Please implement if you need it.'); |
| 21 | } |
| 22 | |
| 23 | if (null === $this->destination) { |
| 24 | \error_log($message, $this->messageType); |
| 25 | } else { |
| 26 | \error_log($message, $this->messageType, $this->destination); |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 |