本文整理汇总了PHP中logger类的典型用法代码示例。如果您正苦于以下问题:PHP logger类的具体用法?PHP logger怎么用?PHP logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* send
* 必有方法,发送时调用.
*
* config参数为getOptions取得的所有项的配置结果
*
* @param mixed $target ['email']
* @param mixed $title
* @param mixed $config
*/
public function send($target, $title, $content, $config)
{
logger::debug(__CLASS__ . var_export(func_get_args(), 1));
$new_msg = array('member_id' => $target['member_id'], 'target' => $target['email'], 'subject' => $title, 'content' => $content, 'createtime' => time(), 'msg_type' => 'email', 'status' => 'sent');
app::get('b2c')->model('member_msg')->save($new_msg);
if (!($email_to = $target['email'])) {
return false;
}
if ($config['sendway'] == 'mail') {
$this->email = vmc::singleton('desktop_email_email');
}
$this->email->Sender = $this->Sender = $config['usermail'];
$this->email->Subject = $this->Subject = $this->email->inlineCode($title);
$From = $this->email->inlineCode(app::get('site')->getConf('site_name')) . '<' . $config['usermail'] . '>';
$header = array('Return-path' => '<' . $config['usermail'] . '>', 'Date' => date('r'), 'From' => $From, 'MIME-Version' => '1.0', 'Subject' => $this->Subject, 'To' => $email_to, 'Content-Type' => 'text/html; charset=UTF-8; format=flowed', 'Content-Transfer-Encoding' => 'base64');
$body = chunk_split(base64_encode($content));
$header = $this->email->buildHeader($header);
$config['sendway'] = $config['sendway'] ? $config['sendway'] : 'smtp';
switch ($config['sendway']) {
case 'sendmail':
$result = $this->email->SendmailSend($email_to, $header, $body);
break;
case 'mail':
$result = $this->email->MailSend($email_to, $header, $body);
break;
case 'smtp':
$result = $this->email->SmtpSend($email_to, $header, $body, $config);
break;
default:
$result = false;
break;
}
return $result;
}
示例2: send_notification
/**
* Sending Push Notification
*/
public function send_notification($registatoin_ids, $message)
{
// include config
include_once 'config.php';
include_once 'logger.php';
$logger = new logger();
// Set POST variables
$url = 'https://android.googleapis.com/gcm/send';
$fields = array('registration_ids' => $registatoin_ids, 'data' => $message);
$headers = array('Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json');
// Open connection
$ch = curl_init();
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Disabling SSL Certificate support temporarly
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
$result = curl_exec($ch);
$logger->write("Result+" . $result);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
// Close connection
curl_close($ch);
//echo $result;
}
示例3: cip_db_query
function cip_db_query($query, $report = 'no', $link = 'db_link')
{
// $report manage a way of error reporting and can be:
// no, direct, return, add_session, add
global ${$link}, $logger, $message;
$result = mysql_query($query, ${$link});
if (defined('STORE_DB_TRANSACTIONS') && STORE_DB_TRANSACTIONS == 'true') {
if (!is_object($logger)) {
$logger = new logger();
}
$logger->write($query, 'QUERY');
if ($result === false) {
$logger->write(mysql_error(), 'ERROR');
}
}
if ($result === false) {
$error = 'SQL error :<b>' . mysql_errno() . ' - ' . mysql_error() . '<br>' . $query;
if ($report == 'direct') {
echo $error;
} elseif ($report == 'return') {
$result = $error;
} elseif ($report == 'add') {
$message->add($error, 'error');
} elseif ($report == 'add_session') {
$message->add_session($error, 'error');
}
return false;
} else {
// Только для запросов SELECT, SHOW, EXPLAIN, DESCRIBE
// mysql_query() возвращает указатель на результат запроса
return $result;
}
}
示例4: tep_redirect
function tep_redirect($url)
{
global $logger;
header('Location: ' . $url);
if (STORE_PAGE_PARSE_TIME == 'true') {
if (!is_object($logger)) {
$logger = new logger();
}
$logger->timer_stop();
}
exit;
}
示例5: tep_db_query
function tep_db_query($query, $link = 'db_link')
{
global ${$link}, $logger;
if (defined('STORE_DB_TRANSACTIONS') && STORE_DB_TRANSACTIONS == 'true') {
if (!is_object($logger)) {
$logger = new logger();
}
$logger->write($query, 'QUERY');
}
$result = mysqli_query(${$link}, $query) or tep_db_error($query, mysqli_errno(${$link}), mysqli_error(${$link}));
return $result;
}
示例6: tep_redirect
function tep_redirect($url)
{
global $logger;
if (strstr($url, "\n") != false || strstr($url, "\r") != false) {
tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false));
}
header('Location: ' . $url);
if (STORE_PAGE_PARSE_TIME == 'true') {
if (!is_object($logger)) {
$logger = new logger();
}
$logger->timer_stop();
}
exit;
}
示例7: log_exception
/**
* Log exception message
*
* @param Exception $error Exception to log
*/
protected function log_exception(Exception $error)
{
if (!isset($this->_logger)) {
$this->_logger = new logger();
}
$this->_logger->write($error->getMessage(), 'ERROR');
}
示例8: post_update
public function post_update($dbver)
{
if ($dbver['dbver'] <= 0.4) {
app::get('ectools')->setConf('ectools_payment_plugin_doubletenpay', 'a:3:{s:7:"setting";a:7:{s:8:"pay_name";s:18:"财付通双接口";s:7:"pay_fee";s:0:"";s:6:"mer_id";s:0:"";s:10:"PrivateKey";s:0:"";s:11:"support_cur";s:1:"1";s:8:"authtype";s:0:"";s:8:"pay_desc";s:6:" ";}s:6:"status";s:5:"false";s:8:"pay_type";s:4:"true";}');
logger::info('UPDATEING 财付通双接口支付方式更新成功');
}
}
示例9: is_return_vaild
public function is_return_vaild($form, $key, $secu_id)
{
$_key = $key;
$sign_type = $secu_id;
$get = $this->para_filter($form);
//对所有GET反馈回来的数据去空
$sort_get = $this->arg_sort($get);
//对所有GET反馈回来的数据排序
$mysign = $this->build_mysign($sort_get, $_key, $sign_type);
//生成签名结果
$mysign = strtoupper($mysign);
if ($mysign == $form['sign']) {
return true;
}
#记录返回失败的情况
logger::error(app::get('ectools')->_('支付单号:') . $form['out_trade_no'] . app::get('ectools')->_('签名验证不通过,请确认!') . "\n");
logger::error(app::get('ectools')->_('本地产生的加密串:') . $mysign);
logger::error(app::get('ectools')->_('手机财付通传递打过来的签名串:') . $form['sign']);
$str_xml .= "<tenpayform>";
foreach ($form as $key => $value) {
$str_xml .= "<{$key}>" . $value . "</{$key}>";
}
$str_xml .= "</tenpayform>";
return false;
}
示例10: generate
/**
* 发货之后通知到微信
*/
public function generate($data)
{
$order_id = $data['order_id'];
$ordersData = app::get('b2c')->model('orders')->getRow('ship_status', array('order_id' => $order_id));
if ($ordersData['ship_status'] != '1') {
$msg = app::get('weixin')->_('未发货不需要同步到微信');
logger::info($msg);
return true;
}
$payments = app::get('ectools')->model('payments')->get_payments_by_order_id($order_id);
if (empty($payments)) {
$msg = app::get('weixin')->_('未找到支付信息');
logger::info($msg);
return true;
}
if ($payments[0]['pay_app_id'] != 'wxpay') {
//$msg = app::get('weixin')->_('不是微信支付不需要通知到微信');
return true;
}
$postData['openid'] = $payments[0]['thirdparty_account'];
$postData['transid'] = $payments[0]['trade_no'];
$postData['out_trade_no'] = $payments[0]['payment_id'];
$postData['deliver_timestamp'] = strval(time());
$postData['deliver_status'] = '1';
$postData['deliver_msg'] = 'ok';
kernel::single('weixin_wechat')->delivernotify($postData);
return true;
}
示例11: get
/**
* Static method get
*
* @param array $group
* @return \helpers\database
*/
public static function get($group = false)
{
// Determining if exists or it's not empty, then use default group defined in config
$group = !$group ? array('type' => DB_TYPE, 'host' => DB_HOST, 'name' => DB_NAME, 'user' => DB_USER, 'pass' => DB_PASS) : $group;
// Group information
$type = $group['type'];
$host = $group['host'];
$name = $group['name'];
$user = $group['user'];
$pass = $group['pass'];
// ID for database based on the group information
$id = "{$type}.{$host}.{$name}.{$user}.{$pass}";
// Checking if the same
if (isset(self::$instances[$id])) {
return self::$instances[$id];
}
try {
// I've run into problem where
// SET NAMES "UTF8" not working on some hostings.
// Specifiying charset in DSN fixes the charset problem perfectly!
$instance = new Database("{$type}:host={$host};dbname={$name};charset=utf8", $user, $pass);
$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Setting Database into $instances to avoid duplication
self::$instances[$id] = $instance;
return $instance;
} catch (PDOException $e) {
//in the event of an error record the error to errorlog.html
Logger::newMessage($e);
logger::customErrorMsg();
}
}
示例12: post_uninstall
public function post_uninstall()
{
$init = kernel::single('cps_init');
logger::info('Uninstall cps');
$inst = kernel::single('cps_theme_inst');
$inst->uninstTheme();
}
示例13: generate
/**
* 订单完成\归档.
*
* @param $sdf array 订单ID\操作者ID\操作者名称
*
* @return bool - 成功与否
*/
public function generate($sdf, &$msg = '')
{
$mdl_order = app::get('b2c')->model('orders');
$order_sdf = $mdl_order->dump($sdf['order_id']);
//订单作废前验证
foreach (vmc::servicelist('b2c.order.end.finish') as $service) {
if (!$service->exec($order_sdf, $msg)) {
return false;
}
}
$order_sdf['status'] = 'finish';
// 更新退款日志结果
if ($mdl_order->save($order_sdf)) {
//订单日志记录
vmc::singleton('b2c_order_log')->set_operator(array('ident' => $sdf['op_id'] ? $sdf['op_id'] : $order_sdf['member_id'], 'model' => $sdf['op_id'] ? 'shopadmin' : 'members', 'name' => $sdf['op_name'] ? $sdf['op_name'] : '会员'))->set_order_id($order_sdf['order_id'])->success('finish', '订单已完成归档!', $order_sdf);
} else {
$msg = '完成\\归档失败!';
return false;
}
//订单作废时同步扩展服务
foreach (vmc::servicelist('b2c.order.end.finish') as $service) {
if (!$service->exec($order_sdf, $msg)) {
//记录日志,不中断
logger::error($sdf['order_id'] . '完成归档时出错!' . $msg);
}
}
return true;
}
示例14: eqphp_autoload
function eqphp_autoload($class)
{
if (isset($_SERVER['REQUEST_URI'])) {
$root = current(explode('/', trim($_SERVER['REQUEST_URI'], '/')));
}
//optimize: $config save memcache or redis
$group = config('group.list');
$path = isset($root) && is_array($group) && in_array($root, $group) ? $root . '/' : '';
$module = array('a' => $path . 'action', 'm' => $path . 'model', 'p' => $path . 'plugin', 's' => 'server');
$prefix = substr($class, 0, strpos($class, '_'));
$dir_name = in_array($prefix, array('a', 'm', 's', 'p')) ? $module[$prefix] : 'class';
$execute_file = $dir_name . '/' . $class . '.php';
if (file_exists($execute_file)) {
return include PATH_ROOT . $execute_file;
}
//通用加载
if (config('state.common_load') && in_array($prefix, array('a', 'm'), true)) {
$common_option = array('a' => 'action/', 'm' => 'model/');
$execute_file = PATH_ROOT . $common_option[$prefix] . $class . '.php';
if (file_exists($execute_file)) {
return include $execute_file;
}
}
//贪婪加载
if (config('state.greedy_load')) {
$execute_file = file::search(PATH_ROOT . $dir_name, $class, $file_list, true);
if ($execute_file) {
return include $execute_file;
}
}
if ($prefix === 'a') {
logger::notice('class [' . $class . '] not found');
http::send(404);
}
}
示例15: __call
public function __call($method, $params)
{
//api 版本历史
$apiv_history = array('2.0', '1.0');
$api_info = base_rpc_service::$api_info;
$api_obj = NULL;
$flag = false;
foreach ($apiv_history as $v) {
if ($this->apiv == $v) {
$flag = true;
}
if ($flag) {
$service = 'apiv_' . $v . '_' . $api_info['api_name'];
$api_obj = kernel::service($service);
if (method_exists($api_obj, $method)) {
break;
} else {
logger::error('apiv service:' . $service . ', method:' . $method . ' not found!');
}
}
}
if (!$api_obj || !method_exists($api_obj, $method)) {
trigger_error('server reject!', E_USER_ERROR);
}
//return call_user_func_array(array( &$api_obj, $method ), $params);
return $api_obj->{$method}($params[0], $params[1]);
}