|
1 | 1 | <?php |
2 | 2 |
|
| 3 | +/* |
| 4 | + * This file is part of the Koded package. |
| 5 | + * |
| 6 | + * (c) Mihail Binev <mihail@kodeart.com> |
| 7 | + * |
| 8 | + * Please view the LICENSE distributed with this source code |
| 9 | + * for the full copyright and license information. |
| 10 | + * |
| 11 | + */ |
| 12 | + |
3 | 13 | namespace Koded\Logging; |
4 | 14 |
|
5 | 15 | use Koded\Logging\Processors\Processor; |
|
12 | 22 | */ |
13 | 23 | interface Logger extends LoggerInterface |
14 | 24 | { |
15 | | - |
16 | | - /** |
| 25 | + /* |
| 26 | + * |
17 | 27 | * Log levels |
| 28 | + * |
18 | 29 | */ |
| 30 | + |
19 | 31 | const EMERGENCY = 1; |
20 | | - const ALERT = 2; |
21 | | - const CRITICAL = 4; |
22 | | - const ERROR = 8; |
23 | | - const WARNING = 16; |
24 | | - const NOTICE = 32; |
25 | | - const INFO = 64; |
26 | | - const DEBUG = 128; |
| 32 | + const ALERT = 2; |
| 33 | + const CRITICAL = 4; |
| 34 | + const ERROR = 8; |
| 35 | + const WARNING = 16; |
| 36 | + const NOTICE = 32; |
| 37 | + const INFO = 64; |
| 38 | + const DEBUG = 128; |
| 39 | + |
| 40 | + /** |
| 41 | + * Add a log processor in the stack. |
| 42 | + * |
| 43 | + * @param Processor $processor Logger processor instance |
| 44 | + * |
| 45 | + * @return Logger |
| 46 | + */ |
| 47 | + public function attach(Processor $processor): Logger; |
| 48 | + |
| 49 | + /** |
| 50 | + * Detach a log processor from registered processors. |
| 51 | + * |
| 52 | + * @param Processor $processor The log processor to detach from the stack. |
| 53 | + * |
| 54 | + * @return Logger |
| 55 | + */ |
| 56 | + public function detach(Processor $processor): Logger; |
27 | 57 |
|
28 | 58 | /** |
29 | 59 | * @param Throwable $e |
30 | 60 | * @param Processor $processor [optional] |
31 | 61 | * |
32 | 62 | * @return void |
33 | 63 | */ |
34 | | - public function exception(Throwable $e, Processor $processor = null); |
| 64 | + public function exception(Throwable $e, Processor $processor = null): void; |
35 | 65 |
|
36 | 66 | /** |
37 | 67 | * Run all log processors to save the accumulated messages |
38 | 68 | * and clean the message stack (after the method is called, |
39 | 69 | * the message stack is emptied). |
40 | 70 | * |
41 | | - * This method should be registered somewhere in the bootstrap phase with |
42 | | - * $log::register() method. |
43 | | - * |
44 | 71 | * It may be called manually as well to instantly dump all messages |
45 | 72 | * (i.e. for Exception handling). |
46 | 73 | * |
47 | 74 | * @return void |
48 | 75 | */ |
49 | | - public function process(); |
50 | | - |
51 | | - /** |
52 | | - * Registers the process method at the PHP's shutdown phase. |
53 | | - * |
54 | | - * @return void |
55 | | - */ |
56 | | - public function register(); |
| 76 | + public function process(): void; |
57 | 77 | } |
0 commit comments