Loggable.php
40 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Framework\Exceptions\Traits; |
| 4 | |
| 5 | trait Loggable { |
| 6 | /** |
| 7 | * Gets the Exception::getMessage() method |
| 8 | * |
| 9 | * @since 2.11.1 |
| 10 | * |
| 11 | * @return string |
| 12 | */ |
| 13 | abstract public function getMessage(); |
| 14 | |
| 15 | /** |
| 16 | * Returns the human-readable log message |
| 17 | * |
| 18 | * @since 2.11.1 |
| 19 | * |
| 20 | * @return string |
| 21 | */ |
| 22 | public function getLogMessage() { |
| 23 | return $this->getMessage(); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Returns an array with the basic context details |
| 28 | * |
| 29 | * @since 2.11.1 |
| 30 | * |
| 31 | * @return array |
| 32 | */ |
| 33 | public function getLogContext() { |
| 34 | return [ |
| 35 | 'category' => 'Uncaught Exception', |
| 36 | 'exception' => $this, |
| 37 | ]; |
| 38 | } |
| 39 | } |
| 40 |