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


PHP Craft::setLogger方法代码示例

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


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

示例1: init

 /**
  * Initializes the console app by creating the command runner.
  */
 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('SchematicBehavior', new Schematic());
     // Attach our own custom Logger
     Craft::setLogger(new Logger());
     // 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', ['Craft\\LocalizationHelper', 'findMissingTranslation']);
     // Set our own custom runtime path.
     $this->setRuntimePath(Craft::app()->path->getRuntimePath());
     // No need for these.
     Craft::app()->log->removeRoute('WebLogRoute');
     Craft::app()->log->removeRoute('ProfileLogRoute');
     // Set the edition components
     $this->_setEditionComponents();
     // Install Craft if needed
     if (!$this->isInstalled()) {
         $this->_installCraft();
     }
     // Set the schematic components
     $this->_setSchematicComponents();
     // Call parent::init() before the plugin console command logic so the command runner gets initialized
     parent::init();
     // Load the plugins
     Craft::app()->plugins->loadPlugins();
     // Validate some basics on the database configuration file.
     Craft::app()->validateDbConfigFile();
     // Add commands
     Craft::app()->commandRunner->commands = [];
     Craft::app()->commandRunner->addCommands(__DIR__ . '/../ConsoleCommands/');
 }
开发者ID:ostark,项目名称:schematic,代码行数:43,代码来源:App.php


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