本文整理汇总了PHP中Factory::getLogger方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getLogger方法的具体用法?PHP Factory::getLogger怎么用?PHP Factory::getLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Factory
的用法示例。
在下文中一共展示了Factory::getLogger方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Factory $factory)
{
$this->factory = $factory;
$this->db = $factory->getDb();
$this->logger = $factory->getLogger();
$this->mainTable = $this->getMainTable();
$this->relationsTable = $this->getRelationsTable();
$this->createTables();
}
示例2: flushResults
private function flushResults()
{
while ($this->mDb->more_results()) {
$this->mDb->next_result();
if ($res = $this->mDb->store_result()) {
if ($res->errorno) {
Factory::getLogger()->error($res->error);
}
$res->free();
}
}
}
示例3: start
public function start()
{
$this->mPeeler->start();
$this->mData = $this->mPeeler->getData();
$c = $this->getConfig();
foreach ($this->mData as &$sourceInfo) {
if (preg_match('/' . $c['peeler']['url_metadata'] . '/', $sourceInfo['url'], $m) == 1) {
$sourceInfo['metadata'] = Utils::purgeNumericSubscripts($m);
} else {
$log = Factory::getLogger();
$log->error("Missing or unexpected information in url: %s", $sourceInfo['url']);
}
}
}
示例4: run
/**
* Run application.
*
* Starts application execution. Iterates through each enabled peeler,
* creates the peeler object, passing in configuration data for
* that peeler and runs it.
*
* @return void
*/
public function run()
{
$log = Factory::getLogger();
$log->message('Peel engine started');
$this->mBase->run();
$c = $this->getConfig();
foreach ($c['peelers'] as $name => $peelerConf) {
if ($peelerConf['peeler']['status'] == 'enabled') {
$this->mPeelers[$name] = Factory::createPeeler($peelerConf);
$this->mPeelers[$name]->start();
}
}
$log->message('Peel engine finished');
}
示例5: getDestinationDir
private function getDestinationDir()
{
$c = $this->getConfig();
$dir = $c['peeler']['download_to'];
if (!file_exists($dir)) {
$log = Factory::getLogger();
$log->warning("Directory %s does not exist", $dir);
if (mkdir($dir, 0777, true)) {
$log->message("Destination directory successfully created");
} else {
$log->error("Could not create destination directory");
$dir = FALSE;
}
}
return $dir;
}
示例6: resolveDestinationPath
public function resolveDestinationPath($dir, $sourceInfo)
{
$log = Factory::getLogger();
$res = $this->mPeeler->resolveDestinationPath($dir, $sourceInfo);
$c = $this->getConfig();
$db = Factory::getDatabase();
switch ($c['peeler']['unique_by']) {
case 'url':
if ($db->urlDownloaded($sourceInfo['url'])) {
$log->message('Skipping %s (already downloaded)', $sourceInfo['url']);
$res = null;
}
break;
case 'checksum':
break;
}
return $res;
}
示例7: getJson
private function getJson()
{
switch ($_GET['json']) {
case 'peel_log':
$log = Factory::getLogger();
$data = $log->getContent();
break;
case 'peel_ctrl':
$conf = Factory::getConfig();
$data = array_map(function ($e) {
return $e['peeler'];
}, $conf['peelers']);
break;
default:
$data = array();
}
return json_encode($data);
}
示例8: expand
private function expand($metadata, $tag)
{
$exp = '';
$parts = explode('|', $tag);
if (isset($metadata[$parts[0]])) {
$exp = trim($metadata[$parts[0]]);
for ($i = 1; $i < count($parts); $i++) {
$params = array();
if (preg_match('/^([^\\(]+)\\(([^\\)]*)\\)$/i', $parts[$i], $m)) {
$func = $m[1];
$params = explode(',', $m[2]);
} else {
$func = strtolower(trim($parts[$i]));
}
$exp = $this->execute($func, $params, $exp);
}
} else {
$log = Factory::getLogger();
$log->error("Missing %s in metadata", $tag);
}
return $exp;
}
示例9: enablePeeler
/**
* Enable available peeler.
*
* Copies the configuration file for the selected peeler from the
* peelers-available directory to the peelers-enabled directory.
*
* @param string $peelerToEnable The name of the peeler that should be enabled.
* @return void
*/
private function enablePeeler($peelerToEnable)
{
if (empty($peelerToEnable)) {
return;
}
$source = sprintf('%s/%s.conf', $this->mPathPeelersAvailable, $peelerToEnable);
$destin = sprintf('%s/%s.conf', $this->mPathPeelersEnabled, $peelerToEnable);
if (!file_exists($destin) && file_exists($source)) {
if (symlink($source, $destin)) {
Factory::getLogger()->message("Peeler %s successfully enabled", $peelerToEnable);
} else {
Factory::getLogger()->error("Unable to acitvate peeler %s", $peelerToEnable);
}
}
}
示例10: __construct
public function __construct($configKey, $apiUrl = '')
{
$this->setConfigKey($configKey);
if ($apiUrl == '') {
$apiUrl = getenv('sofortApiUrl') != '' ? getenv('sofortApiUrl') : self::GATEWAY_URL;
}
$SofortLibHttp = Factory::getHttpConnection($apiUrl);
$XmlDataHandler = Factory::getDataHandler($configKey);
$this->setDataHandler($XmlDataHandler);
$FileLogger = Factory::getLogger();
$this->setLogger($FileLogger);
$this->_DataHandler->setConnection($SofortLibHttp);
$this->enableLogging = getenv('sofortDebug') == 'true' ? true : false;
}