Skip to content

Commit ed377c5

Browse files
committed
- added methods to the interface
= removed `register()` method - add return types to methods - adds the licence
1 parent c67a68a commit ed377c5

1 file changed

Lines changed: 41 additions & 21 deletions

File tree

Logger.php

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
<?php
22

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+
313
namespace Koded\Logging;
414

515
use Koded\Logging\Processors\Processor;
@@ -12,46 +22,56 @@
1222
*/
1323
interface Logger extends LoggerInterface
1424
{
15-
16-
/**
25+
/*
26+
*
1727
* Log levels
28+
*
1829
*/
30+
1931
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;
2757

2858
/**
2959
* @param Throwable $e
3060
* @param Processor $processor [optional]
3161
*
3262
* @return void
3363
*/
34-
public function exception(Throwable $e, Processor $processor = null);
64+
public function exception(Throwable $e, Processor $processor = null): void;
3565

3666
/**
3767
* Run all log processors to save the accumulated messages
3868
* and clean the message stack (after the method is called,
3969
* the message stack is emptied).
4070
*
41-
* This method should be registered somewhere in the bootstrap phase with
42-
* $log::register() method.
43-
*
4471
* It may be called manually as well to instantly dump all messages
4572
* (i.e. for Exception handling).
4673
*
4774
* @return void
4875
*/
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;
5777
}

0 commit comments

Comments
 (0)