1 | <?php |
||
11 | class LoggingDecorator implements Decorator |
||
12 | { |
||
13 | use InnerBusTrait; |
||
14 | /** |
||
15 | * @var LoggerInterface |
||
16 | */ |
||
17 | protected $logger; |
||
18 | |||
19 | /** |
||
20 | * @var mixed|null |
||
21 | */ |
||
22 | protected $context; |
||
23 | |||
24 | /** |
||
25 | * @param LoggerInterface $logger |
||
26 | * @param mixed $context Something which is serializable that will be logged with |
||
27 | * the command execution, such as the request/session information. |
||
28 | * @param CommandBus $innerCommandBus |
||
29 | */ |
||
30 | public function __construct(LoggerInterface $logger, $context = null, CommandBus $innerCommandBus = null) |
||
36 | |||
37 | /** |
||
38 | * Execute a command |
||
39 | * |
||
40 | * @param Command $command |
||
41 | * @throws \Exception |
||
42 | * @return mixed |
||
43 | */ |
||
44 | public function execute(Command $command) |
||
61 | |||
62 | protected function log($message, $command) |
||
67 | |||
68 | protected function createExceptionString(\Exception $e) |
||
73 | } |
||
74 |