1 | <?php |
||
11 | class LoggerMiddleware implements Middleware |
||
12 | { |
||
13 | /** |
||
14 | * The application instance. |
||
15 | * |
||
16 | * @var \Illuminate\Foundation\Application |
||
17 | */ |
||
18 | protected $app; |
||
19 | |||
20 | /** |
||
21 | * The logger instance. |
||
22 | * |
||
23 | * @var \Illuminate\Contracts\Logging\Log |
||
24 | */ |
||
25 | protected $logger; |
||
26 | |||
27 | /** |
||
28 | * Create a new logger middleware. |
||
29 | * |
||
30 | * @param \Illuminate\Contracts\Logging\Log $logger |
||
31 | * @param \Illuminate\Foundation\Application $app |
||
32 | */ |
||
33 | public function __construct(Log $logger, Application $app) |
||
38 | |||
39 | /** |
||
40 | * Write a message to the log whenever a command is received, handled or fails. |
||
41 | * |
||
42 | * @param object $command |
||
43 | * @param callable $next |
||
44 | * @return mixed |
||
45 | * |
||
46 | * @throws Exception |
||
47 | * @throws Throwable |
||
48 | */ |
||
49 | public function execute($command, callable $next) |
||
72 | |||
73 | /** |
||
74 | * Passes message and log level to logger instance. |
||
75 | * |
||
76 | * @param string $logLevel |
||
77 | * @param string|null $message |
||
78 | */ |
||
79 | protected function log($logLevel, $message) |
||
85 | } |
||
86 |