本文整理汇总了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");
}
示例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");
}
示例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;
}