@@ 33-65 (lines=33) @@ | ||
30 | * @param Container $dic [description] |
|
31 | * @return void |
|
32 | */ |
|
33 | public function register(Container $dic) |
|
34 | { |
|
35 | // Do nothing when no loglevel is set |
|
36 | if (empty($this->loglevel)) { |
|
37 | return; |
|
38 | } |
|
39 | ||
40 | // Make sure there's a 'Monolog.Handlers' service |
|
41 | if (!$dic->offsetExists('Monolog.Handlers')) : |
|
42 | $dic['Monolog.Handlers'] = function ($dic) { |
|
43 | return array(); |
|
44 | }; |
|
45 | endif; |
|
46 | ||
47 | ||
48 | /** |
|
49 | * @return array |
|
50 | */ |
|
51 | $dic->extend('Monolog.Handlers', function (array $handlers, $dic) { |
|
52 | $handlers[] = $dic['Monolog.Handlers.BrowserConsoleHandler']; |
|
53 | return $handlers; |
|
54 | }); |
|
55 | ||
56 | ||
57 | ||
58 | /** |
|
59 | * @return BrowserConsoleHandler |
|
60 | */ |
|
61 | $dic['Monolog.Handlers.BrowserConsoleHandler'] = function ($dic) { |
|
62 | $th = new BrowserConsoleHandler($this->loglevel); |
|
63 | return $th; |
|
64 | }; |
|
65 | } |
|
66 | } |
|
67 |
@@ 41-78 (lines=38) @@ | ||
38 | * @param Container $dic [description] |
|
39 | * @return void |
|
40 | */ |
|
41 | public function register(Container $dic) |
|
42 | { |
|
43 | ||
44 | // Do nothing when no incoming_webook_url is set |
|
45 | if (empty($this->incoming_webook_url)) { |
|
46 | return; |
|
47 | } |
|
48 | ||
49 | ||
50 | // Make sure there's a 'Monolog.Handlers' service |
|
51 | if (!$dic->offsetExists('Monolog.Handlers')) : |
|
52 | $dic['Monolog.Handlers'] = function ($dic) { |
|
53 | return array(); |
|
54 | }; |
|
55 | endif; |
|
56 | ||
57 | ||
58 | /** |
|
59 | * @return array |
|
60 | */ |
|
61 | $dic->extend('Monolog.Handlers', function (array $handlers, $dic) { |
|
62 | $handlers[] = $dic['Monolog.Handlers.TeamsHandler']; |
|
63 | return $handlers; |
|
64 | }); |
|
65 | ||
66 | ||
67 | ||
68 | /** |
|
69 | * Send log messages to Microsoft Teams. |
|
70 | * |
|
71 | * @return SlackHandler |
|
72 | */ |
|
73 | $dic['Monolog.Handlers.TeamsHandler'] = function ($dic) { |
|
74 | $th = new TeamsLogHandler($this->incoming_webook_url, $this->loglevel); |
|
75 | $th->setFormatter(new HtmlFormatter); |
|
76 | return $th; |
|
77 | }; |
|
78 | } |
|
79 | } |
|
80 |