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