本文整理汇总了PHP中Piwik\Log::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::getInstance方法的具体用法?PHP Log::getInstance怎么用?PHP Log::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Log
的用法示例。
在下文中一共展示了Log::getInstance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
// make sure logging logic is executed so we can test whether there are bugs in the logging code
Log::getInstance()->setLogLevel(Log::VERBOSE);
$this->ldapUsers = new LdapUsers();
$this->ldapUsers->setLdapServers(array(new ServerInfo("localhost", "basedn")));
$this->ldapUsers->setLdapUserMapper(new UserMapper());
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$url = $input->getOption('url');
if ($input->getOption('piwik-domain') && !$url) {
$_SERVER['argv'][] = '--url=' . $input->getOption('piwik-domain');
}
if (is_string($url) && $url && in_array($url, array('http://', 'https://'))) {
// see http://dev.piwik.org/trac/ticket/5180 and http://forum.piwik.org/read.php?2,115274
throw new \InvalidArgumentException('No valid URL given. If you have specified a valid URL try --piwik-domain instead of --url');
}
if ($input->getOption('verbose')) {
Log::getInstance()->setLogLevel(Log::VERBOSE);
}
include PIWIK_INCLUDE_PATH . '/misc/cron/archive.php';
}
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$url = $input->getOption('url') ?: $input->getOption('piwik-domain');
if (empty($url)) {
throw new \InvalidArgumentException("The --url argument is not set. It should be set to your Piwik URL, for example: --url=http://example.org/piwik/.");
}
if (is_string($url) && $url && in_array($url, array('http://', 'https://'))) {
// see https://github.com/piwik/piwik/issues/5180 and http://forum.piwik.org/read.php?2,115274
throw new \InvalidArgumentException('No valid URL given. If you have specified a valid URL try --piwik-domain instead of --url');
}
if ($input->getOption('verbose')) {
Log::getInstance()->setLogLevel(Log::VERBOSE);
}
$archiver = $this->makeArchiver($url, $input);
try {
$archiver->main();
} catch (Exception $e) {
$archiver->logFatalError($e->getMessage());
}
}
示例4: setUp
public function setUp()
{
if (!function_exists('ldap_bind')) {
throw new \Exception("PHP not compiled w/ --with-ldap!");
}
if (!$this->isLdapServerRunning()) {
throw new \Exception("LDAP server not found on port localhost:389. For integration tests, an LDAP server must be running with the " . "data and configuration found in tests/travis/setup_ldap.sh script. An OpenLDAP server is expected, but any " . "will work assuming the attributes names & data are the same.");
}
parent::setUp();
Log::info("Setting up " . get_class($this));
// make sure logging logic is executed so we can test whether there are bugs in the logging code
Log::getInstance()->setLogLevel(Log::DEBUG);
Config::getInstance()->LoginLdap = Config::getInstance()->LoginLdapTest + array('servers' => 'testserver', 'use_webserver_auth' => 'false', 'new_user_default_sites_view_access' => '1,2', 'synchronize_users_after_login' => 1);
Config::getInstance()->LoginLdap_testserver = Config::getInstance()->LoginLdap_testserver + array('hostname' => self::SERVER_HOST_NAME, 'port' => self::SERVER_PORT, 'base_dn' => self::SERVER_BASE_DN, 'admin_user' => 'cn=fury,' . self::SERVER_BASE_DN, 'admin_pass' => 'secrets');
LdapFunctions::$phpUnitMock = null;
// create sites referenced in setup_ldap.sh
Fixture::createWebsite('2013-01-01 00:00:00');
Fixture::createWebsite('2013-01-01 00:00:00');
Fixture::createWebsite('2013-01-01 00:00:00');
}
示例5: printDebug
public static function printDebug($info = '')
{
if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) {
if (is_object($info)) {
$info = var_export($info, true);
}
Log::getInstance()->setLogLevel(Log::DEBUG);
if (is_array($info) || is_object($info)) {
$info = Common::sanitizeInputValues($info);
$out = var_export($info, true);
foreach (explode("\n", $out) as $line) {
Log::debug($line);
}
} else {
foreach (explode("\n", $info) as $line) {
Log::debug(htmlspecialchars($line, ENT_QUOTES));
}
}
}
}
示例6: initLog
/**
* Configures Piwik\Log so messages are written in output
*/
private function initLog()
{
$config = Config::getInstance();
$log = $config->log;
$log['log_only_when_debug_parameter'] = 0;
$log[Log::LOG_WRITERS_CONFIG_OPTION][] = "screen";
$config->log = $log;
// Make sure we log at least INFO (if logger is set to DEBUG then keep it)
$logLevel = Log::getInstance()->getLogLevel();
if ($logLevel < Log::INFO) {
Log::getInstance()->setLogLevel(Log::INFO);
}
}
示例7: initLog
/**
* Configures Piwik\Log so messages are written in output
*/
private function initLog()
{
$config = Config::getInstance();
/**
* access a property that is not overriden by TestingEnvironment before accessing log as the
* log section is used in TestingEnvironment. Otherwise access to magic __get('log') fails in
* TestingEnvironment as it tries to acccess it already here with __get('log').
* $config->log ==> __get('log') ==> Config.createConfigInstance ==> nested __get('log') ==> returns null
*/
$initConfigToPreventErrorWhenAccessingLog = $config->mail;
$log = $config->log;
$log['log_only_when_debug_parameter'] = 0;
$log[\Piwik\Log::LOG_WRITERS_CONFIG_OPTION] = array("screen");
if (!empty($_GET['forcelogtoscreen'])) {
Log::getInstance()->addLogWriter('screen');
}
// Make sure we log at least INFO (if logger is set to DEBUG then keep it)
$logLevel = Log::getInstance()->getLogLevel();
if ($logLevel != Log::VERBOSE && $logLevel != Log::DEBUG) {
Log::getInstance()->setLogLevel(Log::INFO);
}
$config->log = $log;
}
示例8: setUp
public function setUp()
{
// make sure logging logic is executed so we can test whether there are bugs in the logging code
Log::getInstance()->setLogLevel(Log::VERBOSE);
LdapFunctions::$phpUnitMock = $this->getMock('stdClass', array('ldap_connect', 'ldap_close', 'ldap_bind', 'ldap_search', 'ldap_set_option', 'ldap_get_entries', 'ldap_count_entries'));
}