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