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