Total Complexity | 5 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
13 | trait LogTrait |
||
14 | { |
||
15 | /** |
||
16 | * @var LoggerInterface |
||
17 | */ |
||
18 | private static $logger; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private static $logFormat; |
||
24 | |||
25 | /** |
||
26 | * @return LoggerInterface |
||
27 | */ |
||
28 | 63 | public static function getLogger() |
|
29 | { |
||
30 | 63 | return self::$logger; |
|
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param LoggerInterface $logger |
||
35 | * |
||
36 | * @throws Exception |
||
37 | */ |
||
38 | 1 | public static function setLogger(LoggerInterface $logger) |
|
41 | 1 | } |
|
42 | |||
43 | /** |
||
44 | * @return string |
||
45 | */ |
||
46 | 2 | public static function getLogFormat() |
|
47 | { |
||
48 | return self::$logFormat |
||
49 | 2 | ?: '"{method} {uri} HTTP/{version}" {code} {cost} {hostname} {pid}'; |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * Apache Common Log Format. |
||
54 | * |
||
55 | * @param string $formatter |
||
56 | * |
||
57 | * @link http://httpd.apache.org/docs/2.4/logs.html#common |
||
58 | * @see \GuzzleHttp\MessageFormatter |
||
59 | */ |
||
60 | 1 | public static function setLogFormat($formatter) |
|
63 | 1 | } |
|
64 | } |
||
65 |