Send a message to log

@param string $msg message

@return null
762151
public static function log($msg)
    {
        if (!self::$_enabled) {
            return;
        }

        if (is_null(self::$_file)) {
            echo "log: $msg\n";
            return;
        }

        return self::_logToFile($msg);
    }
1250433
protected function sendTextMsgToJsonString(WxSendTextMsg $msg)
    {
        $formatStr = '{
                        "touser":"%s",
                        "msgtype":"%s",
                        "text":
                        {
                             "content":"%s"
                        }
                    }';
        $result = sprintf($formatStr,   $msg->getToUserName(),
                                        $msg->getMsgType(),
                                        $msg->getContent()
                        );


        return $result;
    }
175483
protected function sendVoiceMsgToJsonString(WxSendVoiceMsg $msg)
    {
        $formatStr = '{
                        "touser":"%s",
                        "msgtype":"%s",
                        "voice":
                        {
                          "media_id":"%s"
                        }
                    }';
        $result = sprintf($formatStr,   $msg->getToUserName(),
                                        $msg->getMsgType(),
                                        $msg->getMediaId()
                        );


        return $result;
    }
1226485
protected function tryLog($msg, $tries = 0)
    {
        if ((bool)@fwrite($this->stream, $msg))
            return;

        if (0 < $tries)
        {
            trigger_error(sprintf('%s - Unable to log message: "%s"', get_called_class(), $tries, $msg));
            return;
        }

        $this->attemptStreamRecovery();

        $this->tryLog($msg, ++$tries);
    }
1185060
protected function sendVoiceMsgToXmlString(WxSendVoiceMsg $msg)
    {
        $formatStr = <<<XML
<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%d</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<Voice>
<MediaId><![CDATA[%s]]></MediaId>
</Voice>
</xml>
XML;
        $result = sprintf($formatStr,   $msg->getToUserName(),
                                        $msg->getFromUserName(),
                                        strtotime($msg->getCreateTime()),
                                        $msg->getMsgType(),
                                        $msg->getMediaId()
                        );


        return $result;
    }
480097
public function sendAll($msg) : void
    {
        foreach ($this->subscriptionTable->findActive() as $row)
        {
            $this->sendNotification($row, $msg, false);
        }

        if ($flush)
        {
            $this->flush();
        }
    }
1094530
public function log($msg)
    {
        $agi = $this->getAgi();
        $this->logger->debug($msg);
        $agi->consoleLog($msg);
    }
520343
protected function sendNewsMsgToXmlString(WxSendNewsMsg $msg)
    {
        $itemArray  = $msg->getAllArticleItems();
        $itemStr    = '';
        foreach ($itemArray as $item) {
            $itemStr .= $this->sendNewsItemToXmlString($item);
        }

        $formatStr = <<<XML
<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%d</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<ArticleCount>%d</ArticleCount>
<Articles>
%s
</Articles>
</xml>
XML;

        $result = sprintf($formatStr,   $msg->getToUserName(),
                                        $msg->getFromUserName(),
                                        strtotime($msg->getCreateTime()),
                                        $msg->getMsgType(),
                                        $msg->getArticleCount(),
                                        $itemStr
                        );

        return $result;
    }
28108
public static function fromMessage(Message $msg)
    {
        $queueStatus = array();
        while ($msg->peek() !== null) {
            $action = $msg->shift();
            $queueStatus[$action] = array(
                'action'    => $action,
                'queue'     => $msg->shift(),
                'busy'      => $msg->shift(),
                'available' => $msg->shift()
            );
        }

        return new self($queueStatus);
    }
1144639
public function message($msg)
    {
        foreach ($this as $client) {
            try {
                $this->execute(
                    "sendtextmessage",
                    array("msg" => $msg, "target" => $client, "targetmode" => Teamspeak::TEXTMSG_CLIENT)
                );
            } catch (TeamSpeak3_Adapter_ServerQuery_Exception $e) {
                /* ERROR_client_invalid_id */
                if ($e->getCode() != 0x0200) {
                    throw $e;
                }
            }
        }
    }
1198616
public function onClientHandlerMessage(ClientHandlerJobRequest $msg)
    {
        $request = new Request($msg->getRequestId(), $msg->getActionName(), $msg->getParameters());
        $this->addRequest($request);

        $this->getStream('clientHandler')->send(
            new ClientHandlerJobResponse(
                $msg->getRequestId(),
                $this->getId()
            )
        );
    }
774142
public function onWorkerHandlerMessage(ClientHandlerJobResponse $msg)
    {
        $this->workerHandlerReady = true;

        $requestId = $msg->getRequestId();
        if (isset($this->workerHandlerQueue[$requestId])) {
            unset($this->workerHandlerQueue[$requestId]);
        }

        $workerHandler = $msg->getWorkerHandlerId();
        $request       = $this->getRequest($requestId);

        if ($request === null) {
            $this->getLogger()->info(
                sprintf(
                    'WorkerHandler %s accepted request %s, but request is unknown.',
                    $workerHandler,
                    $requestId
                )
            );

            return;
        }

        $this->getLogger()->debug(
            sprintf(
                'Worker-handler %s accepted request: %s.',
                $workerHandler,
                $requestId
            )
        );

        $request->setWorkerHandlerId($workerHandler);
    }
383950
public function saveMessage($msg)
    {
	$messages = $this->session->get("FlashInSession", []);
	$messages[] = $msg;
	$this->session->set("FlashInSession", $messages);
    }
908198
protected function sendTextMsgToXmlString(WxSendTextMsg $msg)
    {
        $formatStr = <<<XML
<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%d</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<Content><![CDATA[%s]]></Content>
</xml>
XML;
        $result = sprintf($formatStr,   $msg->getToUserName(),
                                        $msg->getFromUserName(),
                                        strtotime($msg->getCreateTime()),
                                        $msg->getMsgType(),
                                        $msg->getContent()
                        );


        return $result;
    }
52040
public function info($msg) {
		$this->mailMessage(self::LEVEL_INFO, $msg);

		if($this->checkLevel($this->loglevels, self::LEVEL_INFO) !== true)
			return;

		$this->writeMessage(self::LEVEL_INFO, $msg);
	}
1149272
public function handle($msg)
    {
        if (!$msg instanceof JobMessage) {
            if ($this->logger) {
                $this->logger->info('No more message');
            }

            return false;
        }

        return $this->handleMsg($msg);
    }
532917
public function msg($msg)
    {
        $this->log .= date('Y-m-d H:i:s') . ' ' . $msg . "\n";

        if (php_sapi_name() === 'cli') {
            $this->cli->line($msg);
        } else {
            echo $msg . "<br/>\n";
        }
    }