|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the Spryker Commerce OS. |
|
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace Pyz\Glue\Log; |
|
9
|
|
|
|
|
10
|
|
|
use Spryker\Glue\Kernel\Container; |
|
11
|
|
|
use Spryker\Glue\Log\LogDependencyProvider as SprykerLogDependencyProvider; |
|
12
|
|
|
use Spryker\Glue\Log\Plugin\Handler\ExceptionStreamHandlerPlugin; |
|
13
|
|
|
use Spryker\Glue\Log\Plugin\Handler\StreamHandlerPlugin; |
|
14
|
|
|
use Spryker\Glue\Log\Plugin\Processor\EnvironmentProcessorPlugin; |
|
15
|
|
|
use Spryker\Glue\Log\Plugin\Processor\GuzzleBodyProcessorPlugin; |
|
16
|
|
|
use Spryker\Glue\Log\Plugin\Processor\PsrLogMessageProcessorPlugin; |
|
17
|
|
|
use Spryker\Glue\Log\Plugin\Processor\RequestProcessorPlugin; |
|
18
|
|
|
use Spryker\Glue\Log\Plugin\Processor\ResponseProcessorPlugin; |
|
19
|
|
|
use Spryker\Glue\Log\Plugin\Processor\ServerProcessorPlugin; |
|
20
|
|
|
|
|
21
|
|
|
class LogDependencyProvider extends SprykerLogDependencyProvider |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* @param \Spryker\Glue\Kernel\Container $container |
|
25
|
|
|
* |
|
26
|
|
|
* @return \Spryker\Glue\Kernel\Container |
|
27
|
|
|
*/ |
|
28
|
|
|
protected function addLogHandlers(Container $container): Container |
|
29
|
|
|
{ |
|
30
|
|
|
$container->set(static::LOG_HANDLERS, function () { |
|
31
|
|
|
return $this->getLogHandlers(); |
|
32
|
|
|
}); |
|
33
|
|
|
|
|
34
|
|
|
return $container; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @return array<\Monolog\Handler\HandlerInterface> |
|
39
|
|
|
*/ |
|
40
|
|
|
protected function getLogHandlers(): array |
|
41
|
|
|
{ |
|
42
|
|
|
return [ |
|
43
|
|
|
new StreamHandlerPlugin(), |
|
44
|
|
|
new ExceptionStreamHandlerPlugin(), |
|
45
|
|
|
]; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @param \Spryker\Glue\Kernel\Container $container |
|
50
|
|
|
* |
|
51
|
|
|
* @return \Spryker\Glue\Kernel\Container |
|
52
|
|
|
*/ |
|
53
|
|
|
protected function addProcessors(Container $container): Container |
|
54
|
|
|
{ |
|
55
|
|
|
$container->set(static::LOG_PROCESSORS, function () { |
|
56
|
|
|
return $this->getProcessors(); |
|
57
|
|
|
}); |
|
58
|
|
|
|
|
59
|
|
|
return $container; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return array<\Spryker\Shared\Log\Dependency\Plugin\LogProcessorPluginInterface> |
|
64
|
|
|
*/ |
|
65
|
|
|
protected function getProcessors(): array |
|
66
|
|
|
{ |
|
67
|
|
|
return [ |
|
68
|
|
|
new PsrLogMessageProcessorPlugin(), |
|
69
|
|
|
new EnvironmentProcessorPlugin(), |
|
70
|
|
|
new ServerProcessorPlugin(), |
|
71
|
|
|
new RequestProcessorPlugin(), |
|
72
|
|
|
new ResponseProcessorPlugin(), |
|
73
|
|
|
new GuzzleBodyProcessorPlugin(), |
|
74
|
|
|
]; |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|