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


PHP Plugin::getLogger方法代码示例

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


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

示例1: getSimpleAuthData

 public static function getSimpleAuthData(Plugin $plugin, $db = null)
 {
     if (!file_exists($plugin->getDataFolder() . "SimpleAuth/players")) {
         return;
     }
     $config = (new Config($plugin->getDataFolder() . "SimpleAuth/config.yml", Config::YAML))->getAll();
     $provider = $config["dataProvider"];
     switch (strtolower($provider)) {
         case "yaml":
             $plugin->getLogger()->debug("Using YAML data provider");
             $provider = new YAMLDataProvider($plugin);
             break;
         case "sqlite3":
             $plugin->getLogger()->debug("Using SQLite3 data provider");
             $provider = new SQLite3DataProvider($plugin);
             break;
         case "mysql":
             $plugin->getLogger()->debug("Using MySQL data provider");
             $provider = new MySQLDataProvider($plugin);
             break;
         case "none":
         default:
             $provider = new DummyDataProvider($plugin);
             break;
     }
     $folderList = self::getFolderList($plugin->getDataFolder() . "SimpleAuth/players", "folder");
     foreach ($folderList as $alphabet) {
         $ymlList = self::getFolderList($plugin->getDataFolder() . "SimpleAuth/players/" . $alphabet, "file");
         foreach ($ymlList as $ymlName) {
             $yml = (new Config($plugin->getDataFolder() . "SimpleAuth/players/" . $alphabet . "/" . $ymlName, Config::YAML))->getAll();
             $name = explode(".", $ymlName)[0];
             if ($db instanceof PluginData) {
                 $db->addAuthReady(mb_convert_encoding($name, "UTF-8"), $yml["hash"]);
             }
         }
     }
     self::rmdirAll($plugin->getDataFolder() . "SimpleAuth");
 }
开发者ID:RedstoneAlmeida,项目名称:UUIDAuth,代码行数:38,代码来源:SimpleAuthImporter.php

示例2: __construct

 public function __construct(Plugin $plugin)
 {
     $this->plugin = $plugin;
     $config = $this->plugin->getConfig()->get("dataProviderSettings");
     if (!isset($config["host"]) or !isset($config["user"]) or !isset($config["password"]) or !isset($config["database"])) {
         $this->plugin->getLogger()->critical("Invalid MySQL settings");
         $this->plugin->setDataProvider(new DummyDataProvider($this->plugin));
         return;
     }
     $this->database = new \mysqli($config["host"], $config["user"], $config["password"], $config["database"], isset($config["port"]) ? $config["port"] : 3306);
     if ($this->database->connect_error) {
         $this->plugin->getLogger()->critical("Couldn't connect to MySQL: " . $this->database->connect_error);
         $this->plugin->setDataProvider(new DummyDataProvider($this->plugin));
         return;
     }
     $resource = $this->plugin->getResource("mysql.sql");
     $this->database->query(stream_get_contents($resource));
     fclose($resource);
     $this->plugin->getServer()->getScheduler()->scheduleRepeatingTask(new MySQLPingTask($this->plugin, $this->database), 600);
     // Each 30 seconds
     $this->plugin->getLogger()->info("Connected to MySQL server");
 }
开发者ID:RedstoneAlmeida,项目名称:UUIDAuth,代码行数:22,代码来源:MySQLDataProvider.php

示例3: getUniversalMysqliDatabase

 public function getUniversalMysqliDatabase(Plugin $ctx, $disableOnFailure = true)
 {
     if (!$this->universalMysqli instanceof \mysqli) {
         $data = $this->getXEconConfiguration()->getUniMysqlDetails();
         $this->universalMysqli = @new \mysqli($data["host"], $data["username"], $data["password"], $data["database"], $data["port"]);
         if ($this->universalMysqli->connect_error) {
             $ctx->getLogger()->critical("Failed to connect to the xEcon universal MySQL database! " . "Reason: {$this->universalMysqli->connect_error}");
             if ($disableOnFailure) {
                 if ($ctx !== $this) {
                     $desc = $ctx->getDescription();
                     $this->getLogger()->critical("Disabling {$desc->getFullName()} by " . implode(", ", $desc->getAuthors()) . " because the required universal " . "MySQL database cannot be connected to.");
                 } else {
                     $this->getLogger()->critical("Disabling due to required universal MySQL database not connectable.");
                 }
                 $ctx->getPluginLoader()->disablePlugin($ctx);
             }
             $this->universalMysqli = null;
         }
     }
     return $this->universalMysqli;
 }
开发者ID:MCPEGamerJPatGitHub,项目名称:xEcon,代码行数:21,代码来源:XEcon.php


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