Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Ooga\Log;
  4.  
  5. use Illuminate\Support\Arr;
  6. use Monolog\Handler\WhatFailureGroupHandler;
  7. use Monolog\Logger as Monolog;
  8.  
  9. /**
  10. * ログマネージャ
  11. * @package \Ooga\Log
  12. */
  13. class LogManager extends \Illuminate\Log\LogManager
  14. {
  15. public function createCustomStackDriver(array $config)
  16. {
  17. $channels = collect($config['channels'])->map(function ($channel) {
  18. $channel = $this->channel($channel);
  19. return [
  20. 'handlers' => $channel->getHandlers(),
  21. 'processors' => $channel->getProcessors()
  22. ];
  23. })->all();
  24.  
  25. $handlers = Arr::flatten(array_column($channels, 'handlers'));
  26. if ($config['ignore_exceptions'] ?? false) {
  27. $handlers = [new WhatFailureGroupHandler($handlers)];
  28. }
  29.  
  30. return new Monolog($this->parseChannel($config), $handlers, Arr::flatten(array_column($channels, 'processors')));
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement