當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MainLogger::warning方法代碼示例

本文整理匯總了PHP中pocketmine\utils\MainLogger::warning方法的典型用法代碼示例。如果您正苦於以下問題:PHP MainLogger::warning方法的具體用法?PHP MainLogger::warning怎麽用?PHP MainLogger::warning使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pocketmine\utils\MainLogger的用法示例。


在下文中一共展示了MainLogger::warning方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: MainLogger

 \date_default_timezone_set("UTC");
 $logger = new MainLogger(\pocketmine\DATA . "server.log", \pocketmine\ANSI);
 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");
             \date_default_timezone_set("UTC");
             $logger->warning("Timezone could not be automatically determined. An incorrect timezone will result in incorrect timestamps on console logs. It has been set to \"UTC\" by default. You can change it on the php.ini file.");
         }
     }
 } else {
     /*
      * This is here so that people don't come to us complaining and fill up the issue tracker when they put
      * an incorrect timezone abbreviation in php.ini apparently.
      */
     $default_timezone = \date_default_timezone_get();
     if (\strpos($default_timezone, "/") === \false) {
         $default_timezone = \timezone_name_from_abbr($default_timezone);
         \ini_set("date.timezone", $default_timezone);
         \date_default_timezone_set($default_timezone);
     }
 }
 function detect_system_timezone()
開發者ID:VonHirsch,項目名稱:PocketMine-0.13.0,代碼行數:31,代碼來源:PocketMine.php

示例2: MainLogger

 date_default_timezone_set("UTC");
 $logger = new MainLogger(\pocketmine\DATA . "server.log", \pocketmine\ANSI);
 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");
             date_default_timezone_set("UTC");
             $logger->warning("Timezone could not be automatically determined. An incorrect timezone will result in incorrect timestamps on console logs. It has been set to \"UTC\" by default. You can change it on the php.ini file.");
         }
     }
 } else {
     /*
      * This is here so that people don't come to us complaining and fill up the issue tracker when they put
      * an incorrect timezone abbreviation in php.ini apparently.
      */
     $timezone = ini_get("date.timezone");
     if (strpos($timezone, "/") === false) {
         $default_timezone = timezone_name_from_abbr($timezone);
         ini_set("date.timezone", $default_timezone);
         date_default_timezone_set($default_timezone);
     } else {
         date_default_timezone_set($timezone);
     }
開發者ID:robozeri,項目名稱:Yuriko-MP,代碼行數:31,代碼來源:PocketMine.php

示例3: MainLogger

 date_default_timezone_set("UTC");
 $logger = new MainLogger(\pocketmine\DATA . "server.log", \pocketmine\ANSI);
 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");
             date_default_timezone_set("UTC");
             $logger->warning("Timezone could not be automatically determined. An incorrect timezone will result in incorrect timestamps on console logs. It has been set to \"UTC\" by default. You can change it on the php.ini file.");
         }
     }
 } else {
     /*
      * This is here so that people don't come to us complaining and fill up the issue tracker when they put
      * an incorrect timezone abbreviation in php.ini apparently.
      */
     $timezone = ini_get("date.timezone");
     if (strpos($timezone, "/") === false) {
         $default_timezone = timezone_name_from_abbr($timezone);
         ini_set("date.timezone", $default_timezone);
         date_default_timezone_set($default_timezone);
     } else {
         date_default_timezone_set($timezone);
     }
開發者ID:xxFlare,項目名稱:PocketMine-MP,代碼行數:31,代碼來源:PocketMine.php


注:本文中的pocketmine\utils\MainLogger::warning方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。