@param string $channel
@param array  $handlers
@param array  $processors

@return \Monolog\Logger
428629
public static function createLogger( $channel, array $handlers = array(), array $processors = array() )
    {
        if ( !$handlers )
        {
            $_handler = new StreamHandler( static::$_defaultLog );
            $_handler->setFormatter( new PaddedLineFormatter( null, null, true, true ) );

            $handlers = array($_handler);
        }

        return new Logger( $channel ?: static::DEFAULT_CHANNEL_NAME, $handlers, $processors );
    }
762679
public function createStack($handlers): Stack
    {
        if (!is_array($handlers)) {
            $handlers = [$handlers];
        }
        return new Stack(
            $handlers,
            $this->handlerResolver
        );
    }
1166209
public function publishBatch($channel, array $messages)
    {
        $topic = $this->getTopicForChannel($channel);
        $messages = array_map(function ($message) {
            return ['data' => Utils::serializeMessage($message)];
        }, $messages);

        if ($this->backgroundBatching) {
            $batchPublisher = $topic->batchPublisher();
            foreach ($messages as $message) {
                $batchPublisher->publish($message);
            }
        } else {
            $topic->publishBatch($messages);
        }
    }
680076
public function createLogger($channel)
    {
        if (!$this->app->isInstalled()) {
            return new NullLogger();
        }
        $logger = $this->config->createLogger($channel);
        $event = new Event($logger);
        $this->dispatcher->dispatch('on_logger_create', $event);

        return $logger;
    }
1063000
public function channel(string $channel): Observable
    {
        // Only join a channel once
        if (isset($this->channels[$channel])) {
            return $this->channels[$channel];
        }

        // Ensure we only get messages for the given channel
        $channelMessages = $this->messages->filter(function (Event $event) use ($channel) {
            return $event->getChannel() !== '' && $event->getChannel() === $channel;
        });

        $subscribe = $this->connected
            ->do(function () use ($channel) {
                // Subscribe to pusher channel after connected
                $this->send(Event::subscribeOn($channel));
            })
            ->flatMapTo(Observable::empty());

        // Observable representing channel events
        $this->channels[$channel] = $channelMessages
            ->merge($subscribe)
            ->filter([Event::class, 'subscriptionSucceeded'])
            ->retryWhen(function (Observable $errors) {
                return $errors->flatMap(function (Throwable $throwable) {
                    return $this->handleLowLevelError($throwable);
                });
            })
            ->finally(function () use ($channel) {
                // Send unsubscribe event
                $this->send(Event::unsubscribeOn($channel));

                // Remove our channel from the channel list so we don't resubscribe in case we reconnect
                unset($this->channels[$channel]);
            })
            ->singleInstance();

        return $this->channels[$channel];
    }
906161
public function ProcessCustomHandlers (& $handlers = []) {
		if (!$handlers || $this->request->IsInternalRequest() === TRUE) return TRUE;
		$result = TRUE;
		foreach ($handlers as $handlerRecord) {
			list ($closureCalling, $handler) = $handlerRecord;
			$subResult = NULL;
			try {
				if ($closureCalling) {
					$subResult = $handler($this->request, $this->response);
				} else {
					$subResult = call_user_func($handler, $this->request, $this->response);
				}
				if ($subResult === FALSE) {
					$result = FALSE;
					break;
				}
			} catch (\Exception $e) {
				$this->DispatchException($e);
				$result = FALSE;
				break;
			}
		}
		return $result;
	}
141496
public function subscribe($channel, callable $handler)
    {
        $subscription = $this->getSubscriptionForChannel($channel);

        $isSubscriptionLoopActive = true;
        $isPauseEnabled = $this->returnImmediately && ($this->returnImmediatelyPause > 0);

        while ($isSubscriptionLoopActive) {
            $messages = $subscription->pull([
                'grpcOptions' => [
                    'timeoutMillis' => null,
                ],
                'maxMessages' => $this->maxMessages,
                'returnImmediately' => $this->returnImmediately,
            ]);
            if ($isPauseEnabled && empty($messages)) {
                usleep($this->returnImmediatelyPause);
                continue;
            }
            foreach ($messages as $message) {
                /** @var Message $message */
                $payload = Utils::unserializeMessagePayload($message->data());

                if ($payload === 'unsubscribe') {
                    $isSubscriptionLoopActive = false;
                } else {
                    call_user_func($handler, $payload);
                }

                $subscription->acknowledge($message);
            }
        }
    }
43789
public function logger( $channel ) {

		$channel = (string) $channel;
		if ( ! $this->has_channel( $channel ) ) {
			throw InvalidChannelNameException::for_unregistered_channel( $channel );
		}

		if ( ! array_key_exists( $channel, $this->loggers ) ) {
			$this->loggers[ $channel ] = new Logger( $channel );
		}

		if ( ! in_array( $channel, $this->channels_initialized, TRUE ) ) {
			$this->channels_initialized[] = $channel;

			return $this->initialize_logger( $this->loggers[ $channel ] );
		}

		return $this->loggers[ $channel ];
	}
1118165
public function log($level, $message, array $context = array())
    {
        // set default decorator if empty
        if (empty($this->decorators)) {
            $this->addDecorator(new Decorator\InterpolateDecorator());
        }

        // set default handler if empty
        if (empty($this->handlers)) {
            $this->addHandler(new Handler\SyslogHandler(
                $this->getChannel(),
                LogLevel::NOTICE
            ));
        }

        // handling this level ?
        if (!$this->isHandling($level)) {
            return;
        }

        // set channel context (reserved)
        $context['__CHANNEL__'] = $this->getChannel();

        // create logEntry
        if ($this->log_factory) {
            $log = call_user_func(
                $this->log_factory,
                $level,
                $message,
                $context
            );
        } else {
            $log = new LogEntry($level, $message, $context);
        }

        // loop thru decorators
        foreach ($this->decorators as $deco) {
            if (! $deco instanceof Decorator\DecoratorInterface ||
                ! $deco->isDecoratorStopped()) {
                call_user_func($deco, $log);
            }
        }

        // loop thru handlers
        foreach ($this->handlers as $handler) {
            // handler instance
            if ($handler instanceof Handler\HandlerInterface) {
                // call handler instance
                if (!$handler->isHandlerStopped() &&
                    $handler->isHandling($log->getLevel())) {
                    call_user_func($handler, $log);
                }

                // logEntry bubbling stopped ?
                if ($handler->isBubblingStopped()) {
                    break;
                }

            // other callable
            } else {
                call_user_func($handler, $log);
            }
        }
    }
479594
public function logRequest(
        $request,
        $endpoint,
        $method,
        $reference = null,
        $processors = array()
    ) {
        $processedRequest = $this->processPayload($processors, $request);

        $apiCall = $this->apiCallFactory->create();
        $apiCall
            ->setRequest($processedRequest)
            ->setEndpoint($endpoint)
            ->setMethod($method)
            ->setReference($reference)
            ->setRequestTime(microtime(true))
        ;

        $this->handleApiCall($apiCall);

        return $apiCall;
    }
637772
protected function prepareHandlers(array $handlers)
    {
        foreach ($handlers as $key => $handler) {
            $handlers[$key] = $this->prepareHandler($handler);
        }

        return $handlers;
    }
1047414
public function removeLogger($channel)
    {
        if (isset($this->loggers[$channel])) {
            unset($this->loggers[$channel]);
        }

        return $this;
    }
1955
protected static function processNumsub(array $channels)
    {
        $processed = array();
        $count = count($channels);

        for ($i = 0; $i < $count; ++$i) {
            $processed[$channels[$i]] = $channels[++$i];
        }

        return $processed;
    }
786112
public function listenToQueue(array $handlers , $routingKey = null, $options =[] )
    {
        /* Look for handlers */
        $handlersMap = array();
        foreach ($handlers as $handlerClassPath) {
            if (!class_exists($handlerClassPath)) {
                $handlerClassPath = "Kontoulis\\RabbitMQLaravel\\Handlers\\DefaultHandler";
                if (!class_exists($handlerClassPath)) {
                    throw new BrokerException(
                        "Class $handlerClassPath was not found!"
                    );
                }
            }
            $handlerOb = new $handlerClassPath();
            $classPathParts = explode("\\", $handlerClassPath);
            $handlersMap[$classPathParts[count($classPathParts) - 1]] = $handlerOb;
        }

        $this->queueDeclareBind($routingKey);
        /* Start consuming */
        $this->basic_qos(
            (isset($options["prefetch_size"]) ? $options["prefetch_size"] : null),
            (isset($options["prefetch_count"]) ? $options["prefetch_count"] : 1),
            (isset($options["a_global"]) ? $options["a_global"] : null)
        );
        $this->basic_consume(
            $routingKey,
            (isset($options["consumer_tag"]) ? $options["consumer_tag"] : ''),
            (isset($options["no_local"]) ? (bool)$options["no_local"] : false),
            (isset($options["no_ack"]) ? (bool)$options["no_ack"] : false),
            (isset($options["exclusive"]) ? (bool)$options["exclusive"] : false),
            (isset($options["no_wait"]) ? (bool)$options["no_wait"] : false),
            function (AMQPMessage $amqpMsg) use($handlersMap) {
                $msg = Message::fromAMQPMessage($amqpMsg);
                $this->handleMessage($msg, $handlersMap);
            }
        );
        return $this->waitConsume($options);
    }
753352
public function setHandlers(array $handlers)
    {
        $this->handlers = [];

        foreach ($handlers as $handler) {
            $this->addHandler($handler);
        }

        return $this;
    }
320049
protected static function parse_channels($channels)
    {
        if ($channels instanceof Channel) {
            $channels = array($channels);
        } elseif (is_string($channels)) {
            $channels = array(new Channel($channels));
        }
        if (count($channels) == 0) {
            throw new \RuntimeException('channels length is 0');
        }
        return $channels;
    }
365692
public function log($channel, $level, $message, array $context = [])
    {
        if (is_array($channel)) {
            foreach ($channel as $cat) {
                $this->log($cat, $level, $message, $context);
            }

            return $this;
        }

        if (is_array($message)) {
            foreach ($message as $msg) {
                $this->log($channel, $level, $msg, $context);
            }

            return $this;
        }

        $this->getLogger($channel)->log($level, $message, $context);

        return $this;
    }