当前位置: 首页>>代码示例>>PHP>>正文


PHP MainLogger::info方法代码示例

本文整理汇总了PHP中pocketmine\utils\MainLogger::info方法的典型用法代码示例。如果您正苦于以下问题:PHP MainLogger::info方法的具体用法?PHP MainLogger::info怎么用?PHP MainLogger::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\utils\MainLogger的用法示例。


在下文中一共展示了MainLogger::info方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleDataPacket

 public function handleDataPacket(DataPacket $pk)
 {
     $this->logger->debug("Received packet " . $pk::NETWORK_ID . " from {$this->serverIp}:{$this->port}");
     switch ($pk::NETWORK_ID) {
         case Info::INFORMATION_PACKET:
             /** @var InformationPacket $pk */
             switch ($pk->type) {
                 case InformationPacket::TYPE_LOGIN:
                     if ($pk->message == InformationPacket::INFO_LOGIN_SUCCESS) {
                         $this->logger->info("Login success to {$this->serverIp}:{$this->port}");
                         $this->verified = true;
                     } elseif ($pk->message == InformationPacket::INFO_LOGIN_FAILED) {
                         $this->logger->info("Login failed to {$this->serverIp}:{$this->port}");
                     }
                     break;
                 case InformationPacket::TYPE_CLIENT_DATA:
                     $this->clientData = json_decode($pk->message, true);
                     $this->lastRecvInfo = microtime();
                     break;
             }
             break;
         case Info::PLAYER_LOGIN_PACKET:
             /** @var PlayerLoginPacket $pk */
             $player = new Player($this->synLibInterface, mt_rand(0, PHP_INT_MAX), $pk->address, $pk->port);
             $player->setUniqueId($pk->uuid);
             $this->server->addPlayer(spl_object_hash($player), $player);
             $this->players[$pk->uuid->toBinary()] = $player;
             $player->handleLoginPacket($pk);
             break;
         case Info::REDIRECT_PACKET:
             /** @var RedirectPacket $pk */
             if (isset($this->players[$uuid = $pk->uuid->toBinary()])) {
                 $pk = $this->getPacket($pk->mcpeBuffer);
                 $pk->decode();
                 $this->players[$uuid]->handleDataPacket($pk);
             }
             break;
         case Info::PLAYER_LOGOUT_PACKET:
             /** @var PlayerLogoutPacket $pk */
             if (isset($this->players[$uuid = $pk->uuid->toBinary()])) {
                 $this->players[$uuid]->setConnected(false);
                 $this->players[$uuid]->close("", $pk->reason);
                 $this->removePlayer($this->players[$uuid]);
             }
             break;
     }
 }
开发者ID:AnonymousProjects,项目名称:PocketMine-MP-Original,代码行数:47,代码来源:Synapse.php

示例2: Installer

        //Found Git information!
        \define("pocketmine\\GIT_COMMIT", \strtolower(\trim(\file_get_contents(\pocketmine\PATH . ".git/refs/heads/master"))));
    } else {
        //Unknown :(
        \define("pocketmine\\GIT_COMMIT", \str_repeat("00", 20));
    }
    @\define("ENDIANNESS", \pack("d", 1) === "?ð" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN);
    @\define("INT32_MASK", \is_int(4294967295.0) ? 4294967295.0 : -1);
    @\ini_set("opcache.mmap_base", \bin2hex(Utils::getRandomBytes(8, \false)));
    //Fix OPCache address errors
    if (!\file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])) {
        new Installer();
    }
    if (\Phar::running(\true) === "") {
        $logger->warning("Non-packaged PocketMine-MP installation detected, do not use on production.");
    }
    ThreadManager::init();
    $server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
    $logger->info("Stopping other threads");
    foreach (ThreadManager::getInstance()->getAll() as $id => $thread) {
        $logger->debug("Stopping " . (new \ReflectionClass($thread))->getShortName() . " thread");
        $thread->quit();
    }
    $killer = new ServerKiller(8);
    $killer->start();
    $killer->detach();
    $logger->shutdown();
    $logger->join();
    echo Terminal::$FORMAT_RESET . "\n";
    exit(0);
}
开发者ID:VonHirsch,项目名称:PocketMine-0.13.0,代码行数:31,代码来源:PocketMine.php

示例3: define

     //Found Git information!
     define("pocketmine\\GIT_COMMIT", strtolower(trim(file_get_contents(\pocketmine\PATH . ".git/refs/heads/master"))));
 } else {
     //Unknown :(
     define("pocketmine\\GIT_COMMIT", str_repeat("00", 20));
 }
 @define("ENDIANNESS", pack("d", 1) === "?�" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN);
 @define("INT32_MASK", is_int(4294967295.0) ? 4294967295.0 : -1);
 @ini_set("opcache.mmap_base", bin2hex(Utils::getRandomBytes(8, false)));
 //Fix OPCache address errors
 if (!file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])) {
     new Installer();
 }
 if (\Phar::running(true) === "") {
     $logger->warning("Non-packaged Yuriko-MP installation detected! Do not use it on servers! IT CAN REALLY BLOW UP THE ENTIRE SERVER!");
     $logger->info("Don't call us if your server gets destroyed. We advised you!");
 }
 ThreadManager::init();
 $server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
 $logger->info("Stopping other threads");
 foreach (ThreadManager::getInstance()->getAll() as $id => $thread) {
     $logger->debug("Stopping " . (new \ReflectionClass($thread))->getShortName() . " thread");
     $thread->quit();
 }
 $killer = new ServerKiller(8);
 $killer->start();
 $killer->detach();
 $logger->shutdown();
 $logger->join();
 echo Terminal::$FORMAT_RESET . "\n";
 exit(0);
开发者ID:robozeri,项目名称:Yuriko-MP,代码行数:31,代码来源:PocketMine.php

示例4: define

 Terminal::init();
 define("pocketmine\\ANSI", Terminal::hasFormattingCodes());
 if (!file_exists(\pocketmine\DATA)) {
     mkdir(\pocketmine\DATA, 0777, true);
 }
 //Logger has a dependency on timezone, so we'll set it to UTC until we can get the actual timezone.
 date_default_timezone_set("UTC");
 if (!file_exists("katana.yml")) {
     $content = file_get_contents("src/pocketmine/resources/katana.yml");
     @file_put_contents("katana.yml", $content);
 }
 $tmpKatanaProperties = new Config("katana.yml", Config::YAML, []);
 $saveLog = $tmpKatanaProperties->getNested("console.save-console", true);
 $logger = new MainLogger(\pocketmine\DATA . "server.log", \pocketmine\ANSI, $saveLog);
 if ($saveLog) {
     $logger->info("Writing logs to server.log");
 } else {
     $logger->info("Server logging disabled");
 }
 if (!ini_get("date.timezone")) {
     if ($timezone = detect_system_timezone() and date_default_timezone_set($timezone)) {
         //Success! Timezone has already been set and validated in the if statement.
         //This here is just for redundancy just in case some program wants to read timezone data from the ini.
         ini_set("date.timezone", $timezone);
     } else {
         //If system timezone detection fails or timezone is an invalid value.
         if ($response = Utils::getURL("http://ip-api.com/json") and $ip_geolocation_data = json_decode($response, true) and $ip_geolocation_data['status'] != 'fail' and date_default_timezone_set($ip_geolocation_data['timezone'])) {
             //Again, for redundancy.
             ini_set("date.timezone", $ip_geolocation_data['timezone']);
         } else {
             ini_set("date.timezone", "UTC");
开发者ID:TexusDark,项目名称:Katana,代码行数:31,代码来源:PocketMine.php

示例5: isset

 \ini_set("memory_limit", -1);
 \define("pocketmine\\START_TIME", \microtime(\true));
 $opts = \getopt("", ["data:", "plugins:", "no-wizard", "enable-profiler"]);
 \define("pocketmine\\DATA", isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
 \define("pocketmine\\PLUGIN_PATH", isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
 Terminal::init();
 \define("pocketmine\\ANSI", Terminal::hasFormattingCodes());
 if (!\file_exists(\pocketmine\DATA)) {
     \mkdir(\pocketmine\DATA, 0777, \true);
 }
 //Logger has a dependency on timezone, so we'll set it to UTC until we can get the actual timezone.
 \date_default_timezone_set("UTC");
 $saveLog = false;
 $logger = new MainLogger(\pocketmine\DATA . "server.log", \pocketmine\ANSI, $saveLog);
 if ($saveLog) {
     $logger->info("Writing logs to server.log");
 } else {
     $logger->info("Server logging disabled");
 }
 if (!\ini_get("date.timezone")) {
     if ($timezone = detect_system_timezone() and \date_default_timezone_set($timezone)) {
         //Success! Timezone has already been set and validated in the if statement.
         //This here is just for redundancy just in case some program wants to read timezone data from the ini.
         \ini_set("date.timezone", $timezone);
     } else {
         //If system timezone detection fails or timezone is an invalid value.
         if ($response = Utils::getURL("http://ip-api.com/json") and $ip_geolocation_data = \json_decode($response, \true) and $ip_geolocation_data['status'] != 'fail' and \date_default_timezone_set($ip_geolocation_data['timezone'])) {
             //Again, for redundancy.
             \ini_set("date.timezone", $ip_geolocation_data['timezone']);
         } else {
             \ini_set("date.timezone", "UTC");
开发者ID:AASSuper,项目名称:PocketMine_0.13,代码行数:31,代码来源:PocketMine.php


注:本文中的pocketmine\utils\MainLogger::info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。