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


PHP Craft::setLogger方法代碼示例

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


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

示例1: init

 /**
  * Initializes the console app by creating the command runner.
  *
  * @return null
  */
 public function init()
 {
     // Set default timezone to UTC
     date_default_timezone_set('UTC');
     // Import all the built-in components
     foreach ($this->componentAliases as $alias) {
         Craft::import($alias);
     }
     // Attach our Craft app behavior.
     $this->attachBehavior('AppBehavior', new AppBehavior());
     // Initialize Cache and LogRouter right away (order is important)
     $this->getComponent('cache');
     $this->getComponent('log');
     // So we can try to translate Yii framework strings
     $this->coreMessages->attachEventHandler('onMissingTranslation', array('Craft\\LocalizationHelper', 'findMissingTranslation'));
     // Set our own custom runtime path.
     $this->setRuntimePath(craft()->path->getRuntimePath());
     // Attach our own custom Logger
     Craft::setLogger(new Logger());
     // No need for these.
     craft()->log->removeRoute('WebLogRoute');
     craft()->log->removeRoute('ProfileLogRoute');
     // Load the plugins
     craft()->plugins->loadPlugins();
     // Validate some basics on the database configuration file.
     craft()->validateDbConfigFile();
     // Call parent::init before the plugin console command logic so craft()->commandRunner will be available to us.
     parent::init();
     foreach (craft()->plugins->getPlugins() as $plugin) {
         $commandsPath = craft()->path->getPluginsPath() . StringHelper::toLowerCase($plugin->getClassHandle()) . '/consolecommands/';
         if (IOHelper::folderExists($commandsPath)) {
             craft()->commandRunner->addCommands(rtrim($commandsPath, '/'));
         }
     }
 }
開發者ID:kentonquatman,項目名稱:portfolio,代碼行數:40,代碼來源:ConsoleApp.php

示例2: init

 /**
  * Processes resource requests before anything else has a chance to initialize.
  */
 public function init()
 {
     // Set default timezone to UTC
     date_default_timezone_set('UTC');
     // Import all the built-in components
     foreach ($this->componentAliases as $alias) {
         Craft::import($alias);
     }
     // Initialize HttpRequestService and LogRouter right away
     $this->getComponent('request');
     $this->getComponent('log');
     // Set our own custom runtime path.
     $this->setRuntimePath($this->path->getRuntimePath());
     // Attach our own custom Logger
     Craft::setLogger(new Logger());
     // If we're not in devMode or this is a resource request, we're going to remove some logging routes.
     if (!$this->config->get('devMode') || ($resourceRequest = $this->request->isResourceRequest()) == true) {
         // If it's a resource request, we don't want any logging routes, including craft.log
         // If it's not a resource request, we'll keep the FileLogRoute around.
         if ($resourceRequest) {
             $this->log->removeRoute('FileLogRoute');
         }
         // Don't need either of these if not in devMode or it's a resource request.
         $this->log->removeRoute('WebLogRoute');
         $this->log->removeRoute('ProfileLogRoute');
     }
     parent::init();
 }
開發者ID:kentonquatman,項目名稱:portfolio,代碼行數:31,代碼來源:WebApp.php

示例3: init

 /**
  * Initializes the application.
  *
  * @return null
  */
 public function init()
 {
     // NOTE: Nothing that triggers a database connection should be made here until *after* _processResourceRequest()
     // in processRequest() is called.
     // Import all the built-in components
     foreach ($this->componentAliases as $alias) {
         Craft::import($alias);
     }
     // Attach our Craft app behavior.
     $this->attachBehavior('AppBehavior', new AppBehavior());
     // If there is a custom validationKey set, apply it here.
     if ($validationKey = $this->config->get('validationKey')) {
         $this->security->setValidationKey($validationKey);
         // Make sure any instances of Yii's CSecurityManager class are using the custom validation
         // key as well
         $this->getComponent('securityManager')->setValidationKey($validationKey);
     }
     // Attach our own custom Logger
     Craft::setLogger(new Logger());
     // If there is a custom appId set, apply it here.
     if ($appId = $this->config->get('appId')) {
         $this->setId($appId);
     }
     // Initialize Cache, HttpRequestService and LogRouter right away (order is important)
     $this->getComponent('cache');
     $this->getComponent('request');
     $this->getComponent('log');
     // So we can try to translate Yii framework strings
     $this->coreMessages->attachEventHandler('onMissingTranslation', array('Craft\\LocalizationHelper', 'findMissingTranslation'));
     // Set our own custom runtime path.
     $this->setRuntimePath($this->path->getRuntimePath());
     // Set the edition components
     $this->_setEditionComponents();
     parent::init();
 }
開發者ID:amite,項目名稱:arc-va,代碼行數:40,代碼來源:WebApp.php

示例4: init

 /**
  * Initializes the application.
  *
  * @return null
  */
 public function init()
 {
     // NOTE: Nothing that triggers a database connection should be made here until *after* _processResourceRequest()
     // in processRequest() is called.
     // Set default timezone to UTC
     date_default_timezone_set('UTC');
     // Import all the built-in components
     foreach ($this->componentAliases as $alias) {
         Craft::import($alias);
     }
     // Attach our Craft app behavior.
     $this->attachBehavior('AppBehavior', new AppBehavior());
     // Initialize Cache, HttpRequestService and LogRouter right away (order is important)
     $this->getComponent('cache');
     $this->getComponent('request');
     // Attach our own custom Logger
     Craft::setLogger(new Logger());
     $this->getComponent('log');
     // So we can try to translate Yii framework strings
     $this->coreMessages->attachEventHandler('onMissingTranslation', array('Craft\\LocalizationHelper', 'findMissingTranslation'));
     // Set our own custom runtime path.
     $this->setRuntimePath($this->path->getRuntimePath());
     // If there is a custom appId set, apply it here.
     if ($appId = $this->config->get('appId')) {
         $this->setId($appId);
     }
     parent::init();
 }
開發者ID:kant312,項目名稱:sop,代碼行數:33,代碼來源:WebApp.php

示例5: init

 /**
  * @return null
  */
 public function init()
 {
     // Set default timezone to UTC
     date_default_timezone_set('UTC');
     // Import all the built-in components
     foreach ($this->componentAliases as $alias) {
         Craft::import($alias);
     }
     // Attach our Craft app behavior.
     $this->attachBehavior('AppBehavior', new AppBehavior());
     // Initialize Cache, HttpRequestService and LogRouter right away (order is important)
     $this->getComponent('cache');
     $this->getComponent('request');
     $this->getComponent('log');
     // So we can try to translate Yii framework strings
     $this->coreMessages->attachEventHandler('onMissingTranslation', array('Craft\\LocalizationHelper', 'findMissingTranslation'));
     // Set our own custom runtime path.
     $this->setRuntimePath($this->path->getRuntimePath());
     // Attach our own custom Logger
     Craft::setLogger(new Logger());
     // If we're not in devMode, we're going to remove some logging routes.
     if (!$this->config->get('devMode')) {
         $this->log->removeRoute('WebLogRoute');
         $this->log->removeRoute('ProfileLogRoute');
     }
     // If there is a custom appId set, apply it here.
     if ($appId = $this->config->get('appId')) {
         $this->setId($appId);
     }
     parent::init();
 }
開發者ID:kentonquatman,項目名稱:portfolio,代碼行數:34,代碼來源:WebApp.php


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