本文整理汇总了PHP中Logger::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::getInstance方法的具体用法?PHP Logger::getInstance怎么用?PHP Logger::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submit
public static function submit($shop_id, $shop_key, $host, $t_request)
{
$process = curl_init($host);
$json = json_encode($t_request);
Logger::getInstance()->write("Request to {$host}", Logger::DEBUG, get_class());
Logger::getInstance()->write("with Shop Id " . Settings::$shopId . " & Shop key " . Settings::$shopKey, Logger::DEBUG, get_class());
if (!empty($json)) {
Logger::getInstance()->write("with message " . $json, Logger::DEBUG, get_class());
}
if (!empty($t_request)) {
curl_setopt($process, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-type: application/json'));
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_POSTFIELDS, $json);
}
curl_setopt($process, CURLOPT_URL, $host);
curl_setopt($process, CURLOPT_USERPWD, Settings::$shopId . ":" . Settings::$shopKey);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($process);
$error = curl_error($process);
curl_close($process);
if ($response === false) {
throw new \Exception("cURL error " . $error);
}
Logger::getInstance()->write("Response {$response}", Logger::DEBUG, get_class());
return $response;
}
示例2: testTerminalLogger
public function testTerminalLogger()
{
$config = Config::getInstance();
$config->setValue('log_location', false);
$logger = Logger::getInstance();
// $logger->logStatus('Singleton logger should echo this', get_class($this));
}
示例3: setUp
public function setUp()
{
parent::setUp();
$this->logger = Logger::getInstance();
$this->DAO = new GroupMySQLDAO();
$this->builders = self::buildData();
}
示例4: setUp
public function setUp()
{
parent::setUp();
StreamMessageQueueFactory::$queue = null;
$this->logger = Logger::getInstance();
$this->config = Config::getInstance();
}
示例5: shutdownStreams
/**
* @return void
*/
public function shutdownStreams()
{
$logger = Logger::getInstance('stream_log_location');
$logger->logInfo("in TwitterRealtimePlugin->shutdownStreams()", __METHOD__ . ',' . __LINE__);
$stream_master = new StreamMasterCollect();
$stream_master->shutdownStreams();
}
示例6: __construct
/**
*
* @param Instance $instance
* @return GooglePlusCrawler
*/
public function __construct($instance, $access_token)
{
$this->instance = $instance;
$this->logger = Logger::getInstance();
$this->access_token = $access_token;
$this->api_accessor = new GooglePlusAPIAccessor();
}
示例7: __construct
/**
*
* @param Instance $instance
* @return FacebookCrawler
*/
public function __construct($instance, $access_token, $max_crawl_time)
{
$this->instance = $instance;
$this->logger = Logger::getInstance();
$this->access_token = $access_token;
$this->max_crawl_time = $max_crawl_time;
}
示例8: setUp
public function setUp()
{
parent::setUp();
$this->logger = Logger::getInstance();
$r = array('id' => 1, 'network_username' => 'Gina Trapani', 'network_user_id' => '606837591', 'network_viewer_id' => '606837591', 'last_post_id' => '0', 'last_page_fetched_replies' => 0, 'last_page_fetched_tweets' => '0', 'total_posts_in_system' => '0', 'total_replies_in_system' => '0', 'total_follows_in_system' => '0', 'is_archive_loaded_replies' => '0', 'is_archive_loaded_follows' => '0', 'crawler_last_run' => '', 'earliest_reply_in_system' => '', 'avg_replies_per_day' => '2', 'is_public' => '0', 'is_active' => '0', 'network' => 'facebook', 'last_favorite_id' => '0', 'last_unfav_page_checked' => '0', 'last_page_fetched_favorites' => '0', 'owner_favs_in_system' => '0', 'total_posts_by_owner' => 0, 'posts_per_day' => 1, 'posts_per_week' => 1, 'percentage_replies' => 50, 'percentage_links' => 50, 'earliest_post_in_system' => '01-01-2009', 'favorites_profile' => '0');
$this->instance = new Instance($r);
}
示例9: start
public function start()
{
$c = Configurator::getInstance();
$l = Logger::getInstance();
if (isset($c->config['logfile']))
$l->setLogfile($c->config['logfile']);
if ((!isset($c->config['debugmode'])) || ($c->config['debugmode'] == "false"))
$l->debug(FALSE);
elseif (is_numeric($c->config['debugmode']))
$l->debug($c->config['debugmode']);
elseif ($c->config['debugmode'] == "true")
$l->debug(3);
else
$l->debug(FALSE);
if (isset($c->config['die']))
_die("Icarus: read the config file!");
$this->loadClients();
$this->loadServers();
$this->running = TRUE;
$SH = SocketHandler::getInstance();
$SH->loop();
}
示例10: run
public function run()
{
if (!isset($this->cronToken)) {
return;
}
if ($this->cronToken === "") {
return;
}
if ($this->cronToken !== Config::getInstance()->getCronToken()) {
return;
}
$database = Database::getInstance();
if (!$database->isConnected()) {
return;
}
$site = Site::getInstance();
if (!$site->doesCronNeedToRun()) {
return;
}
if ($site->isCronRunning()) {
return;
}
$site->setCronRunning(true);
$site->setLastCronRun(new DateTime());
$hookEngine = HookEngine::getInstance();
$hookEngine->runAction('cronRun');
$logger = Logger::getInstance();
$logger->logIt(new LogEntry(1, logEntryType::info, "Cron ran.", 0, new DateTime()));
$site->setCronRunning(false);
}
示例11: logger
/**
*
* @return string parsed logger output
*/
protected function logger()
{
if (!(isset($this->config['logger']) && !$this->config['logger'])) {
return '<div class="container">' . Logger::getInstance()->toString() . '</div>';
}
return '';
}
示例12: run
public function run()
{
// Set up IRC connection
$c = new IRCConnection(new IRCUser($this->config->readString('irc', 'nickname', 'KrokerdilBot'), $this->config->readString('irc', 'realname', NULL), $this->config->readString('irc', 'username', NULL), $this->config->readString('irc', 'hostname', 'localhost')), $this->config->readString('irc', 'server'));
// Reset socket timeout to a better value for IRC (this
// prevents IOExceptions being thrown over and over again)
$c->sock->setTimeout(120);
// Check if debug is wanted and *where* it's wanted
if ($this->debug) {
$c->setTrace(Logger::getInstance()->getCategory()->withAppender(new FileAppender('php://stderr')));
}
// Connect and run the bot
$c->addListener(new KrokerdilBotListener($this->config));
while (1) {
try {
$c->open();
$c->run();
$c->close();
} catch (IOException $e) {
$e->printStackTrace();
// Fall through
}
// Wait for 10 seconds and then try to reconnect
sleep(10);
}
}
示例13: __construct
function __construct($agency, $xml)
{
$this->xml = $xml;
$this->agency = $agency;
$this->logger = Logger::getInstance();
$this->appConfig = Configuration::getAppConfig();
}
示例14: crawl
function crawl()
{
global $db;
global $conn;
$config = Config::getInstance();
$api_key = $config->getValue('flickr_api_key');
if (isset($api_key) && $api_key != '') {
$logger = Logger::getInstance();
$fa = new FlickrAPIAccessor($api_key);
$ldao = DAOFactory::getDAO('LinkDAO');
$flickrlinkstoexpand = $ldao->getLinksToExpandByURL('http://flic.kr/');
if (count($flickrlinkstoexpand > 0)) {
$logger->logStatus(count($flickrlinkstoexpand) . " Flickr links to expand", "Flickr Plugin");
} else {
$logger->logStatus("No Flickr links to expand", "Flickr Plugin");
}
foreach ($flickrlinkstoexpand as $fl) {
$eurl = $fa->getFlickrPhotoSource($fl);
if ($eurl["expanded_url"] != '') {
$ldao->saveExpandedUrl($fl, $eurl["expanded_url"], '', 1);
} elseif ($eurl["error"] != '') {
$ldao->saveExpansionError($fl, $eurl["error"]);
}
}
$logger->close();
# Close logging
}
}
示例15: setUp
public function setUp()
{
parent::setUp();
$this->logger = Logger::getInstance();
$r = array('id' => 1, 'network_username' => 'Gina Trapani', 'network_user_id' => '113612142759476883204', 'network_viewer_id' => '113612142759476883204', 'last_post_id' => '0', 'total_posts_in_system' => '0', 'total_replies_in_system' => '0', 'total_follows_in_system' => '0', 'is_archive_loaded_replies' => '0', 'is_archive_loaded_follows' => '0', 'crawler_last_run' => '', 'earliest_reply_in_system' => '', 'avg_replies_per_day' => '2', 'is_public' => '0', 'is_active' => '0', 'network' => 'google+', 'last_favorite_id' => '0', 'owner_favs_in_system' => '0', 'total_posts_by_owner' => 0, 'posts_per_day' => 1, 'posts_per_week' => 1, 'percentage_replies' => 50, 'percentage_links' => 50, 'earliest_post_in_system' => '2009-01-01 13:48:05', 'favorites_profile' => '0');
$this->profile1_instance = new Instance($r);
}