本文整理汇总了PHP中log::write方法的典型用法代码示例。如果您正苦于以下问题:PHP log::write方法的具体用法?PHP log::write怎么用?PHP log::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log
的用法示例。
在下文中一共展示了log::write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: payment
public function payment($sum)
{
// На бете альфе включаем дебаг режим
if (!is_release()) {
//$sum = 0.1;// @debug
$this->api->setDebug(true);
}
$result = $this->api->requestPayment(round((double) $sum, 2), $this->account->id);
if ($result['status'] == API_Webmoney::STATUS_SUCCESS) {
$process = $this->api->processPayment($this->api->merchant_transaction_id, $result['processor_transaction_id']);
switch ($process['status']) {
case API_Webmoney::STATUS_PAYMENT_PROGRESS:
case API_Webmoney::STATUS_PAYMENT_SUCCESS:
// Зачисляем деньги на бете/альфе
// if(!is_release()) {
// $paymentDateTime = date('d.m.Y H:i');
// $orderNumber = rand(1, 99999999);
// $descr = "WebMoney с кошелька {$this->data['wallet']} сумма - {$sum}, обработан {$paymentDateTime}, номер покупки - $orderNumber";
//
// $this->account->deposit($op_id, $this->account->id, $sum, $descr, 3, $sum, 12);
// }
return true;
break;
case API_Webmoney::STATUS_PAYMENT_FAIL:
ob_start();
var_dump($result);
var_dump($process);
$content = ob_get_clean();
$this->log->writeln("FAIL Payment:\naccount:{$this->account->id}\n");
$this->log->write("Request:\n " . $this->api->last_request->getBody());
$this->log->write("Result:\n {$content}");
return false;
break;
// Отложить платеж на пол часа
// @todo придумать как отложить запрос на потом
//case API_Webmoney::STATUS_PAYMENT_PROCESS:
// Отложить платеж на пол часа
// @todo придумать как отложить запрос на потом
//case API_Webmoney::STATUS_PAYMENT_PROCESS:
default:
return;
break;
}
} else {
ob_start();
var_dump($result);
$content = ob_get_clean();
$this->log->writeln("FAIL Payment:\naccount:{$this->account->id}\n");
$this->log->write("Request:\n " . $this->api->last_request->getBody());
$this->log->write("Result:\n {$content}");
return false;
}
}
示例2: query
public function query($sql){
$rs = mysql_query($sql);
log::write(date('Y-m-d H:i:s', time()).'--->'.$sql); //记录日志
return $rs;
}
示例3: query
public function query($sql)
{
$rs = mysqli_query($this->conn, $sql);
log::write($sql);
log::write(time());
return $rs;
}
示例4: query
public function query($sql)
{
$rs = mysqli_query($this->conn, $sql);
log::write($sql);
//log::write(" result:" . $rs);
return $rs;
}
示例5: clearMemcache
public function clearMemcache()
{
$result = $this->memcached->flush();
if (!$result) {
log::write("MemDb::clearMemcach() failed", "log");
return false;
}
return true;
}
示例6: execute
function execute($sql)
{
try {
global $_conn;
$_conn->execute($sql);
} catch (Exception $e) {
log::write($e->getMessage(), "execute");
}
}
示例7: test_writing_to_file
function test_writing_to_file()
{
log::write(array(VAR_DIR . '/tmp/', 'test.log'), 'wow');
$this->assertTrue(file_exists(VAR_DIR . '/tmp/test.log'));
$arr = file(VAR_DIR . '/tmp/test.log');
$this->assertNotNull($arr[0]);
if (isset($_SERVER['REQUEST_URI'])) {
$this->assertWantedPattern('|' . preg_quote($_SERVER['REQUEST_URI']) . '|', $arr[1]);
}
$this->assertWantedPattern('|wow|', $arr[2]);
}
示例8: get
/**
* 获取账户信息
*
*/
public static function get($account_id)
{
$post_url = "http://manage.backstage-gateway.com/account";
$post_var = "account_id=" . $account_id;
$result = tool::curl_pay($post_url, $post_var);
$res = @unserialize(stripcslashes($result));
if (!is_array($res)) {
log::write('data_error', $result, __FILE__, __LINE__);
}
return $res;
}
示例9: GetOne
public function GetOne($id)
{
$query = 'SELECT * FROM ' . $this->tableName . ' WHERE id=:id';
$param[':id'] = $id;
$res = $this->query($query, $param);
if (empty($res)) {
$log = new log();
$log->write('Trying to get unexisting article');
throw new E404Exception('The article with id=' . $id . ' was not found');
}
return $this->query($query, $param)[0];
}
示例10: validate
/**
* Validates and optionally saves a new delivery category from an array.
*
* @param array value to check
* @param boolean save the record when validation succeeds
* @return boolean
*/
public function validate(array &$array, $save = FALSE, &$errors)
{
$fields = parent::as_array();
$array = array_merge($fields, $array);
$array = Validation::factory($array)->pre_filter('trim')->add_rules('name', 'required', 'length[1,255]')->add_rules('ename', 'required', 'length[1,255]')->add_rules('description', 'length[1,1000]')->add_rules('edescription', 'length[1,1000]');
if (parent::validate($array, $save)) {
return TRUE;
} else {
$errors = $array->errors();
log::write('form_error', $errors, __FILE__, __LINE__);
return FALSE;
}
}
示例11: query
public function query($sql)
{
// if($this->conf->debug){
// log::write($sql);
// }
$rs = $this->conn->query($sql);
log::write($sql);
if (!$rs) {
//log::write($this->error());
log::write("error");
}
return $rs;
}
示例12: validate
public function validate(array &$array, $save = FALSE, &$errors)
{
$fields = parent::as_array();
$array = array_merge($fields, $array);
$array = Validation::factory($array)->pre_filter('trim')->add_rules('status', 'numeric')->add_rules('manager_id', 'numeric')->add_rules('user_log_type', 'numeric')->add_rules('ip', 'length[0,255]')->add_rules('method', 'length[0,255]')->add_rules('memo', 'length[0,512]');
if (parent::validate($array, $save)) {
return TRUE;
} else {
$errors = $array->errors();
log::write('form_error', $errors, __FILE__, __LINE__);
return FALSE;
}
}
示例13: validate
/**
* Validates and optionally saves a new user record from an array.
*
* @param array values to check
* @param boolean save the record when validation succeeds
* @return boolean
*/
public function validate(array &$array, $save = FALSE, &$errors)
{
$fields = parent::as_array();
$array = array_merge($fields, $array);
$array = Validation::factory($array)->pre_filter('trim')->add_rules('host', 'required', 'length[0,255]')->add_rules('port', 'required', 'numeric')->add_rules('username', 'required', 'length[0,255]')->add_rules('password', 'required', 'length[0,255]');
if (parent::validate($array, $save)) {
return TRUE;
} else {
$errors = $array->errors();
log::write('Smtp_queue_form_error', $errors, __FILE__, __LINE__);
return FALSE;
}
}
示例14: error
public static function error($errno, $errstr, $errfile, $errline)
{
switch ($errno) {
case E_ERROR:
case E_USER_ERROR:
$errormsg = "[" . L("exceptionhd_error1") . "]{$errstr}\t[" . L("exceptionhd_error2") . "]{$errfile}\t[" . L("exceptionhd_error3") . "]{$errline}";
log::write($errormsg);
error($errormsg);
break;
case E_USER_WARNING:
case E_USER_NOTICE:
default:
$errormsg = "[" . L("exceptionhd_error4") . "] {$errstr}\t[" . L("exceptionhd_error5") . "]{$errfile}\t[" . L("exceptionhd_error6") . "]{$errline}";
self::notice(func_get_args());
log::set($errormsg);
}
}
示例15: customError
function customError($errno, $errstr, $errfile, $errline)
{
global $_charset, $KYPHP, $kyphp_error_no, $kyphp_errors;
switch ($errno) {
case E_NOTICE:
case E_USER_NOTICE:
$error = $_charset['notice'];
break;
case E_WARNING:
case E_USER_WARNING:
$error = $_charset['warning'];
break;
case E_ERROR:
case E_USER_ERROR:
$error = $_charset['fatal'];
break;
default:
$error = $_charset['unknow'];
break;
}
if (empty($KYPHP)) {
if (!strstr($errstr, 'mysql_close')) {
echo $error . ':' . $errstr . 'at:' . $errfile . ' line:' . $errline;
}
return;
}
$error_display = $KYPHP->config->get('error_display');
$error_log = $KYPHP->config->get('error_log');
if (!$error_display) {
$error_display = 'on';
}
if (!$error_log) {
$error_log = 'on';
}
$kyphp_errors[] = array($errno, $errstr, $errfile, $errline);
$KYPHP->config->set('error', $kyphp_errors);
if ($error_log == 'on') {
$log = new log('error.txt');
$log->write($error . ':' . $errstr . ' at:' . $errfile . ' line:' . $errline);
}
if ($error_display == 'on') {
kyphp_display_error($errno, $errstr, $errfile, $errline, $kyphp_error_no);
$kyphp_error_no++;
}
//die();
}