Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
 
3
/*
4
 * This file is part of the Monolog package.
5
 *
6
 * (c) Jordi Boggiano <j.boggiano@seld.be>
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
/**
15
 * Forwards records to multiple handlers suppressing failures of each handler
16
 * and continuing through to give every handler a chance to succeed.
17
 *
18
 * @author Craig D'Amelio <craig@damelio.ca>
19
 *
20
 * @phpstan-import-type Record from \Monolog\Logger
21
 */
22
class WhatFailureGroupHandler extends GroupHandler
23
{
24
    /**
25
     * {@inheritDoc}
26
     */
27
    public function handle(array $record): bool
28
    {
29
        if ($this->processors) {
30
            /** @var Record $record */
31
            $record = $this->processRecord($record);
32
        }
33
 
34
        foreach ($this->handlers as $handler) {
35
            try {
36
                $handler->handle($record);
37
            } catch (\Throwable $e) {
38
                // What failure?
39
            }
40
        }
41
 
42
        return false === $this->bubble;
43
    }
44
 
45
    /**
46
     * {@inheritDoc}
47
     */
48
    public function handleBatch(array $records): void
49
    {
50
        if ($this->processors) {
51
            $processed = array();
52
            foreach ($records as $record) {
53
                $processed[] = $this->processRecord($record);
54
            }
55
            /** @var Record[] $records */
56
            $records = $processed;
57
        }
58
 
59
        foreach ($this->handlers as $handler) {
60
            try {
61
                $handler->handleBatch($records);
62
            } catch (\Throwable $e) {
63
                // What failure?
64
            }
65
        }
66
    }
621 lars 67
 
68
    /**
69
     * {@inheritDoc}
70
     */
71
    public function close(): void
72
    {
73
        foreach ($this->handlers as $handler) {
74
            try {
75
                $handler->close();
76
            } catch (\Throwable $e) {
77
                // What failure?
78
            }
79
        }
80
    }
148 lars 81
}