本文整理汇总了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/');
}