本文整理汇总了PHP中Phalcon\DI\FactoryDefault::getLogger方法的典型用法代码示例。如果您正苦于以下问题:PHP FactoryDefault::getLogger方法的具体用法?PHP FactoryDefault::getLogger怎么用?PHP FactoryDefault::getLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\DI\FactoryDefault
的用法示例。
在下文中一共展示了FactoryDefault::getLogger方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
});
/**
* Main logger file
*/
$di->set('logger', function () {
return new FileLogger(__DIR__ . '/../var/logs/' . date('Y-m-d') . '.log');
}, true);
/**
* Error handler
*/
set_error_handler(function ($errno, $errstr, $errfile, $errline) use($di) {
if (!(error_reporting() & $errno)) {
return;
}
$di->getFlash()->error($errstr);
$di->getLogger()->log($errstr . ' ' . $errfile . ':' . $errline, Logger::ERROR);
return true;
});
/**
* Handle the request
*/
$application = new Application();
$application->setDI($di);
/**
* Register application modules
*/
$application->registerModules(require __DIR__ . '/../common/config/modules.php');
echo $application->handle()->getContent();
} catch (Exception $e) {
echo $e->getMessage();
} catch (PDOException $e) {
示例2: function
$di->set('notifications', function () {
return new NotificationsChecker();
}, true);
//Translation application use Gettext or Native Array
$di->set('translation', function () use($di) {
$language = $di->get('config')->language;
$code = $language->code;
if ($di->getCookies()->has('code')) {
$code = $di->getCookies()->get('code')->getValue();
}
if ($language->gettext) {
$translation = new Gettext(['locale' => $code, 'directory' => ROOT_DIR . 'core/lang', 'defaultDomain' => 'messages']);
} else {
$path = ROOT_DIR . 'core/lang/messages/' . $code . '.php';
if (!file_exists($path)) {
$di->getLogger()->error("You must specify a language file for language '{$code}'");
$path = ROOT_DIR . 'core/lang/messages/en.php';
}
$translation = new NativeArray(['content' => require_once $path]);
}
return $translation;
}, true);
//Queue to deliver e-mails in real-time
$di->set('queue', function () use($di) {
$config = $di->get('config');
if (isset($config->beanstalk->disabled) && $config->beanstalk->disabled) {
return new DummyServer();
}
if (!isset($config->beanstalk->host)) {
throw new \Exception('Beanstalk is not configured');
}