PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / trunk
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance vtrunk
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / monolog / monolog / src / Monolog / Handler / FallbackGroupHandler.php

FallbackGroupHandler.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance trunk, at vendor/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php

72 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types=1);
2
3 /*
4 * This file is part of the Monolog package.
5 *
6 * (c) Jordi Boggiano <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Monolog\Handler;
13
14 use Throwable;
15
16 /**
17 * Forwards records to at most one handler
18 *
19 * If a handler fails, the exception is suppressed and the record is forwarded to the next handler.
20 *
21 * As soon as one handler handles a record successfully, the handling stops there.
22 *
23 * @phpstan-import-type Record from \Monolog\Logger
24 */
25 class FallbackGroupHandler extends GroupHandler
26 {
27 /**
28 * {@inheritDoc}
29 */
30 public function handle(array $record): bool
31 {
32 if ($this->processors) {
33 /** @var Record $record */
34 $record = $this->processRecord($record);
35 }
36 foreach ($this->handlers as $handler) {
37 try {
38 $handler->handle($record);
39 break;
40 } catch (Throwable $e) {
41 // What throwable?
42 }
43 }
44
45 return false === $this->bubble;
46 }
47
48 /**
49 * {@inheritDoc}
50 */
51 public function handleBatch(array $records): void
52 {
53 if ($this->processors) {
54 $processed = [];
55 foreach ($records as $record) {
56 $processed[] = $this->processRecord($record);
57 }
58 /** @var Record[] $records */
59 $records = $processed;
60 }
61
62 foreach ($this->handlers as $handler) {
63 try {
64 $handler->handleBatch($records);
65 break;
66 } catch (Throwable $e) {
67 // What throwable?
68 }
69 }
70 }
71 }
72