本文整理汇总了PHP中Phalcon\Logger\Adapter\File::getFormatter方法的典型用法代码示例。如果您正苦于以下问题:PHP File::getFormatter方法的具体用法?PHP File::getFormatter怎么用?PHP File::getFormatter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Logger\Adapter\File
的用法示例。
在下文中一共展示了File::getFormatter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
public static function register(Di $di)
{
static::$hostname = gethostname();
$di->remove('log');
static::$logger = null;
$di->setShared('log', function () {
$filePath = storagePath('logs');
is_dir($filePath) or mkdir($filePath, 0777, true);
$filePath .= '/' . Config::get('app.log.file', 'phwoolcon.log');
$logger = new File($filePath);
$formatter = $logger->getFormatter();
if ($formatter instanceof Line) {
$formatter->setDateFormat('Y-m-d H:i:s');
$formatter->setFormat('[%date%]{host}[%type%] {request} %message%');
}
return $logger;
});
}
示例2: function
$gettext->setOptions(['compileAlways' => $compileAlways, 'locale' => $locale->getBestLocale(), 'supported' => $locale->getSupportedLocales(), 'domains' => $config->locale->domains, 'localeDir' => $config->path->localeDir, 'localeCacheDir' => $config->path->localeCacheDir]);
return $gettext;
});
/**
*
*/
$di->setShared('debug', function () use($di) {
$config = $di->getConfig();
$logger = new MultipleStreamLogger();
switch (ENV) {
case DEV_ENV:
$logger->push(new ErrorLogger());
if ('cli' != php_sapi_name()) {
$debugLogFile = str_replace('{{name}}', $config->site->domains[0], $config->dev->path->debugLog);
$fileLogger = new FileLogger($debugLogFile);
$fileLogger->getFormatter()->setFormat('%message%');
$logger->push($fileLogger);
$logger->push(new Firelogger());
$logger->push(new FirephpLogger(''));
}
break;
}
return $logger;
});
/**
* Mail service
*/
$di->setShared('mailer', function () use($di) {
$config = $di->get('config');
$mailManager = new MailManager($config->mailer, $config->site->mail);
$mailManager->setDI($di);
示例3: getFormatter
public function getFormatter()
{
return parent::getFormatter();
}