本文整理汇总了PHP中Logger::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::get方法的具体用法?PHP Logger::get怎么用?PHP Logger::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetGetStorageAsInteger
/**
* Test that the storage number can be set and retrieved.
*/
public function testSetGetStorageAsInteger()
{
$randNumber = rand(9999, 99999);
$logger = new Logger();
$logger->set('testNumber', $randNumber);
$this->assertSame($randNumber, $logger->get('testNumber'));
}
示例2: _log
private function _log($msg, $level = E_USER_NOTICE, $file = '', $line = '', $context = '')
{
$loggerFunction = Logger::get();
if (is_object($loggerFunction)) {
$loggerFunction->log_error($level, $msg, $file, $line, $context);
} else {
trigger_error($msg, $level);
}
}
示例3: remove
public function remove()
{
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
Cache::removeAll(true);
Language::rebuildCacheFor($this->config->get('language_id'));
$files = $this->scan(DIR_IMAGE . 'cache/*', array());
$check = array();
if (is_array($files)) {
foreach ($files as $file) {
@unlink($file);
}
}
$this->response->setOutput(json_encode(Logger::get('warning')));
}
}
示例4: getDescription
/**
* Get the full description.
*
* @return string The description.
*/
public function getDescription()
{
$output = array($this->docblock->getShortDescription() . ' ');
$parsed_contents = $this->docblock->getLongDescription()->getParsedContents();
if (is_array($parsed_contents) && count($parsed_contents) > 0) {
foreach ($parsed_contents as $content) {
if (is_string($content)) {
$output[] = $content;
} elseif ($content instanceof DBTag) {
$dtag = new InlineTag($content, $this->ancestry);
$output[] = $dtag->determine()->process(ConfigStore::get('source.resolve_aliases'));
} else {
Logger::get()->{ConfigStore::get('log.error')}('Unknown inline tag object:', array(__FILE__, print_r($content, true)));
}
}
}
return $output;
}
示例5: ttrss_fatal_handler
function ttrss_fatal_handler()
{
global $logger;
$error = error_get_last();
if ($error !== NULL) {
$errno = $error["type"];
$file = $error["file"];
$line = $error["line"];
$errstr = $error["message"];
if (!$errno) {
return false;
}
$context = debug_backtrace();
$file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1);
if (class_exists("Logger")) {
return Logger::get()->log_error($errno, $errstr, $file, $line, $context);
}
}
return false;
}
示例6: log
function log()
{
$logmsg = $this->dbh->escape_string($_REQUEST['logmsg']);
if ($logmsg) {
Logger::get()->log_error(E_USER_WARNING, $logmsg, '[client-js]', 0, false);
}
echo json_encode(array("message" => "HOST_ERROR_LOGGED"));
}
示例7: define
<?php
require '../configure.php';
define('LOGGER_DEFAULT_THRESHOLD', 2);
$logger = Logger::get();
$logger->debug("Test debug - shouldn't see me");
$logger->info("Test info");
$logger->warn("Test warn");
$logger->error("Test error");
示例8: request
/**
* Performs the actual request.
*
* @param string $method
* @param string $url
* @param array $parameters
* @return string
*/
protected function request($method, $url, $parameters = array())
{
Logger::get()->debug('HTTP: starting request...');
$headers = $this->headers;
// Add accepted content type header.
$headers[] = 'Content-Type: ' . $this->contentType;
$headers[] = 'Accept: ' . $this->acceptedContentType;
$handler = curl_init();
if (!is_null($this->user)) {
curl_setopt($handler, CURLOPT_USERPWD, $this->user . ':' . $this->password);
}
Logger::get()->debug('HTTP: method is ' . $method);
switch ($method) {
case self::METHOD_DELETE:
curl_setopt($handler, CURLOPT_URL, $url . '?' . http_build_query($parameters));
curl_setopt($handler, CURLOPT_CUSTOMREQUEST, self::DELETE);
break;
case self::METHOD_POST:
curl_setopt($handler, CURLOPT_URL, $url);
curl_setopt($handler, CURLOPT_POST, true);
curl_setopt($handler, CURLOPT_POSTFIELDS, $parameters);
break;
case self::METHOD_GET:
curl_setopt($handler, CURLOPT_URL, $url . '?' . http_build_query($parameters));
break;
}
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handler, CURLOPT_HTTPHEADER, $headers);
Logger::get()->debug('HTTP: headers set.');
// Send the request to the server.
Logger::get()->debug("HTTP: requesting {$url}...");
$output = curl_exec($handler);
$errNo = curl_errno($handler);
$error = curl_error($handler);
// Obtain the status.
Logger::get()->debug('HTTP: Done. Getting status...');
$status = curl_getinfo($handler, CURLINFO_HTTP_CODE);
// The handler is no longer needed.
curl_close($handler);
Logger::get()->debug('HTTP: request finished.');
if ($errNo) {
throw new Exception('HTTP: cURL failed: ' . $error, $errNo);
}
// If cURL had no errors itself, then there is an HTTP response.
switch ($status) {
case self::STATUS_OK:
case self::STATUS_CREATED:
case self::STATUS_ACCEPTED:
case self::STATUS_NO_CONTENT:
return $output;
default:
throw new Http\Exception("HTTP {$status}", $status);
}
}