本文整理汇总了PHP中Log::out方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::out方法的具体用法?PHP Log::out怎么用?PHP Log::out使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::out方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare
public function prepare($sql, $options = array())
{
Log::out(__METHOD__ . " {$sql}", Log::LEVEL_DEBUG);
$this->last_sql = $sql;
$stmt = parent::prepare($sql, $options);
return $stmt;
}
示例2: getResponse
public static function getResponse($request)
{
$url = "http://www.simsimi.com/";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
curl_close($ch);
list($header, $body) = explode("\r\n\r\n", $content);
preg_match_all("/set\\-cookie:([^\r\n]*);/iU", $header, $matches);
if ($matches[1]) {
if (is_array($matches[1])) {
$cookie = implode('; ', $matches[1]);
} else {
$cookie = $matches[1];
}
$cookie .= ';JSESSIONID=D7377356FFB38283A73E0DB385015DE6;popupCookie=true;locale=ch;sagree=true; selected_nc=ch; __utma=119922954.1488831110.1375456791.1381545568.1384225632.3;__utmb=119922954.7.9.1384225656789; __utmc=119922954; __utmz=119922954.1375456791.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);';
$header = array('Cookie: ' . $cookie, 'Host: www.simsimi.com', 'Referer: http://www.simsimi.com/talk.htm', 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36', 'X-Requested-With: XMLHttpRequest');
$url = "http://www.simsimi.com/func/req?lc=ch&msg=" . $request;
$content = Tools::curl($url, 'GET', null, $header);
if ($content instanceof Exception) {
return false;
} else {
$content = json_decode($content);
if ($content->result == 100) {
return $content->response;
} else {
Log::out("simi_error", 'E', json_encode($content));
}
}
}
return false;
}
示例3: dispatchLoopShutdown
public function dispatchLoopShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response)
{
$start = Yaf_Registry::get('benchmark_start');
Yaf_Registry::del('benchmark_start');
$time = microtime(true) - (double) $start;
if ($time > 1) {
Log::out('benchmark', 'I', $request->getRequestUri() . ':' . $time . ':' . memory_get_usage(true) / 1024 . 'kb');
}
}
示例4: create
/**
* Creates instance of Config class and loads configuration file if passed
*
* @param $file configuration file to load
* @return void
* @static
*/
public static function create($file = null)
{
if (is_null(self::$instance)) {
self::$instance = new self();
}
if ($file && is_readable($file)) {
$vars_to_add = (require $file);
Log::out(__METHOD__ . ' Configuration file loaded: "' . $file . '"', Log::LEVEL_DEBUG);
self::setVar($vars_to_add);
} elseif ($file && !is_readable($file)) {
throw new BakedCarrotException('Cannot read configuration file: ' . $file);
}
return self::$instance;
}
示例5: connect
/**
* Connects to database
* All the parameters could also be set in config file:
*
* 'db_dsn' => 'mysql:dbname=bakedcarrot;host=localhost',
* 'db_username' => 'db_user',
* 'db_password' => 'db_password',
* 'db_charset' => 'utf8',
*
* @static
* @param null $dsn DSN in PDO format
* @param null $username username to connect to database server
* @param null $password connection password
* @param string $charset default character set
* @return void
* @throws BakedCarrotDbException
*/
public static function connect($dsn = null, $username = null, $password = null, $charset = 'utf8')
{
if (!is_null(self::$pdo) && !$dsn) {
return;
} elseif (!is_null(self::$pdo) && $dsn) {
self::$pdo = null;
}
if (!$dsn) {
if (!Config::checkVar('db_dsn')) {
throw new BakedCarrotDbException('Database access parameters are not properly configured');
}
$dsn = Config::getVar('db_dsn');
$username = Config::getVar('db_username');
$password = Config::getVar('db_password');
$charset = Config::getVar('db_charset', 'utf8');
}
self::$pdo = new DbPDO($dsn, $username, $password, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::MYSQL_ATTR_INIT_COMMAND => 'set names ' . $charset, PDO::ATTR_AUTOCOMMIT => true));
Log::out(__METHOD__ . ' Connected to: "' . $dsn . '"', Log::LEVEL_DEBUG);
}
示例6: update
public function update($skip_validation = false, $enable_hook = true, $null_values = false)
{
if (!Object::$db) {
Object::$db = Db::getInstance();
}
if ($enable_hook && method_exists($this, 'beforeUpdate')) {
$this->beforeUpdate();
}
if (property_exists($this, 'date_update')) {
$this->date_update = date('Y-m-d H:i:s');
}
$fields = $this->getFields($skip_validation, true);
if (!is_array($fields)) {
Log::out('fieldserror', 'E', $fields);
return 'Fields error' . $fields;
}
if (!($result = Object::$db->update($this->def['table'], $fields, '`' . pSQL($this->def['primary']) . '` = ' . (int) $this->id, 0, $null_values))) {
return 'Add object db error';
}
if ($enable_hook && method_exists($this, 'afterUpdate')) {
$this->afterUpdate();
}
$this->cleanCache(true, true);
return true;
}
示例7: response
/**
* 向微信服务器ECHO内容
*
* @param $content
*/
private static function response($content)
{
if (self::$debug) {
Log::out("weixin_debug", 'I', 'echo:' . $content);
}
echo $content;
}
示例8: handleDefaultException
/**
* Handles default exception if it wasn't handled before
*
* @param Exception $e exception to be handled
* @return void
* @static
*/
private function handleDefaultException($e)
{
Log::out(get_class($e) . ', ' . $e->getMessage(), Log::LEVEL_CRIT);
if (php_sapi_name() == 'cli') {
print "\n" . get_class($e) . " occured\n" . 'Message: ' . $e->getMessage() . "\n" . 'Code: ' . $e->getCode() . "\n" . $e->getTraceAsString() . "\n";
} else {
if ($e instanceof BakedCarrotNotFoundException) {
if (!headers_sent()) {
header('HTTP/1.0 404 Not Found');
}
if (Request::isAjax() || Request::isFlash()) {
print $e->getMessage();
} else {
print '<html><head></head><body style="font: 10pt arial; margin: 40px;">' . '<h1 style="font-weight: normal; font-size: 30px;">404 Page Not Found</h1>' . ($e->getMessage() ? '<h3 style="margin: 0; font-weight: normal;">Message: ' . $e->getMessage() . '</h3>' : '') . (self::isDevMode() ? '<p>' . nl2br($e->getTraceAsString()) . '</p>' : '') . '</body>';
}
} else {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (Request::isAjax() || Request::isFlash()) {
print 'EXCEPTION (' . get_class($e) . '): ' . $e->getMessage() . "\n";
if (self::isDevMode() && get_class($e) == 'PDOException') {
print 'SQL: ' . Db::lastSql();
}
} else {
print '<html><head></head><body style="font: 10pt arial; margin: 40px;">' . '<h1 style="font-weight: normal; font-size: 30px;">' . get_class($e) . ' occured</h1>' . '<h3 style="margin: 0; font-weight: normal;">Message: ' . $e->getMessage() . '</h3>' . '<h3 style="margin: 0; font-weight: normal;">Code: ' . $e->getCode() . '</h3>' . (self::isDevMode() && get_class($e) == 'PDOException' ? '<h3 style="margin: 0;">SQL: ' . Db::lastSql() . '</h3>' : '') . (self::isDevMode() ? '<p>' . nl2br($e->getTraceAsString()) . '</p>' : '') . '<h4 style="font-weight: normal;"><em>Baked Carrot ver ' . BAKEDCARROT_VERSION . '</em></h4>' . '</body>';
}
}
}
exit(-1);
}
示例9: _connect
/**
* Get a database connection instance
*
* @access private
*
* @param $dbConn a database connection if no error
* @return $error error string
*/
private static function _connect(&$dbConn)
{
$error = "";
Log::in("Pool connect");
$server = Pool::$_config['server'];
if (Pool::$_config['port'] != "") {
$server .= ':' . Pool::$_config['port'];
}
/* Connect */
if (!($dbConn = mysql_connect($server, Pool::$_config['username'], Pool::$_config['password']))) {
$error = mysql_error($dbConn);
Log::out("Pool connect error");
return $error;
}
/* Open the database */
Pool::$_dbName = Pool::$_config['database'];
if (!($selected = mysql_select_db(Pool::$_dbName, $dbConn))) {
$error = mysql_error($dbConn);
Log::out("Pool connect db select error");
return $error;
}
/* Success */
Log::out("Pool connect sucess");
return $error;
}
示例10: outFriendName
public function outFriendName()
{
if ($this->friend) {
Log::out('Friend\'s name ' . $this->friend->getName());
}
}
示例11: execute
public function execute($request, $session = null)
{
if ($this->checkRequest) {
try {
$request->check();
} catch (Exception $e) {
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
}
//组装系统参数
$sysParams["app_key"] = $this->appkey;
$sysParams["v"] = $this->apiVersion;
$sysParams["format"] = $this->format;
$sysParams["sign_method"] = $this->signMethod;
$sysParams["method"] = $request->getApiMethodName();
$sysParams["timestamp"] = date("Y-m-d H:i:s");
$sysParams["partner_id"] = $this->sdkVersion;
if (null != $session) {
$sysParams["session"] = $session;
}
//获取业务参数
$apiParams = $request->getApiParas();
//签名
$sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams));
//系统参数放入GET请求串
$requestUrl = $this->gatewayUrl . "?";
foreach ($sysParams as $sysParamKey => $sysParamValue) {
$requestUrl .= "{$sysParamKey}=" . urlencode($sysParamValue) . "&";
}
$requestUrl = substr($requestUrl, 0, -1);
//发起HTTP请求
try {
$resp = $this->curl($requestUrl, $apiParams);
} catch (Exception $e) {
$this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_ERROR_" . $e->getCode(), $e->getMessage());
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
//解析TOP返回结果
$respWellFormed = false;
if ("json" == $this->format) {
$respObject = json_decode($resp);
if (null !== $respObject) {
$respWellFormed = true;
foreach ($respObject as $propKey => $propValue) {
$respObject = $propValue;
}
}
} else {
if ("xml" == $this->format) {
$respObject = @simplexml_load_string($resp);
if (false !== $respObject) {
$respWellFormed = true;
}
}
}
//返回的HTTP文本不是标准JSON或者XML,记下错误日志
if (false === $respWellFormed) {
$content = $sysParams['method'] . '_' . $requestUrl . '_HTTP_RESPONSE_NOT_WELL_FORMED_' . $resp;
Log::out('taobao', 'E', $content);
$result->code = 0;
$result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED";
return $result;
}
//如果TOP返回了错误码,记录到业务错误日志中
if (isset($respObject->code)) {
$content = $content = $sysParams['method'] . '_' . $requestUrl . '_' . $resp;
Log::out('taobao', 'E', $content);
}
return $respObject;
}
示例12: logError
protected function logError($sql = false)
{
if ($this->getNumberError()) {
Log::out('sql_error', 'E', $this->getMsgError() . ':' . $sql);
}
}
示例13: resolveAttributes
/**
* Resolve a files extended attributes
*
* @access public
*
* @param $retval file extended attributes
*/
public static function resolveAttributes(&$retval)
{
Log::in("query - resolveAtributes");
/* For printing via modxfs-getfattr for instance we need to
* resolve things like user number to a name, template id to
* a name, dates into strings etc.
* We are only using select statements here, if a query fails
* just leave the attribute alone and move on.
*/
$dbConn = Pool::get();
$prefix = Pool::getTableprefix();
foreach ($retval as $key => &$value) {
switch ($key) {
case 'editedon':
case 'createdon':
case 'pub_date':
case 'unpub_date':
case 'deletedon':
case 'publishedon':
$value = strftime("%G-%m-%j %H:%M:%S", $value);
break;
case 'parent':
$sql = "SELECT pagetitle";
$sql .= " FROM `{$prefix}" . "site_content`";
$sql .= " WHERE id = {$value}";
$result = mysql_query($sql, $dbConn);
if ($result !== false) {
$row = mysql_fetch_assoc($result);
if ($row['pagetitle'] != "") {
$value = $row['pagetitle'];
}
}
break;
case 'template':
$sql = "SELECT templatename";
$sql .= " FROM `{$prefix}" . "site_templates`";
$sql .= " WHERE id = {$value}";
$result = mysql_query($sql, $dbConn);
if ($result !== false) {
$row = mysql_fetch_assoc($result);
if ($row['templatename'] != "") {
$value = $row['templatename'];
}
}
break;
case 'editedby':
case 'deletedby':
case 'publishedby':
case 'createdby':
/* Only manager users here */
$sql = "SELECT username";
$sql .= " FROM `{$prefix}" . "manager_users`";
$sql .= " WHERE id = {$value}";
$result = mysql_query($sql, $dbConn);
if ($result !== false) {
$row = mysql_fetch_assoc($result);
if ($row['username'] != "") {
$value = $row['username'];
}
}
break;
default:
break;
}
}
Pool::release($dbConn);
Log::out("query - resolveAtributes");
}
示例14: checkoutMode
/**
* Are we in create(VCS checkout) mode
*
* @access public
*
*/
public static function checkoutMode()
{
if (file_exists(PassThru::$_realPath . '/checkoutmode')) {
Log::out("passthru - checkoutMode positive");
return true;
}
return false;
}
示例15: listxattr
/**
* List extended attributes of a file/directory
*
* @access public
*
* @param $path file path
* @param $retval file name array of extended attributes
*/
function listxattr($path, &$retval)
{
Log::in("LISTXATTR {$path}");
/* Check for passthru */
if (PassThru::check($path)) {
$ret = PassThru::listxattr($path, $retval);
} else {
$pi = Query::pathInfo($path);
Query::fillContentId($pi, 0);
$ret = Query::listxattr($pi, $retval);
if ($ret == 0) {
Query::resolveAttributes($retval);
}
}
Log::out("LISTXATTR");
return $ret;
}