本文整理匯總了PHP中logger::error方法的典型用法代碼示例。如果您正苦於以下問題:PHP logger::error方法的具體用法?PHP logger::error怎麽用?PHP logger::error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類logger
的用法示例。
在下文中一共展示了logger::error方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}
示例2: dologin
public function dologin()
{
$enc_str = $_GET['enc_str'];
$enc_str = app::get('mobile')->router()->decode_args($enc_str);
$member_id = $_GET['mid'];
$decode_enc = utils::decrypt($enc_str);
$session_id = $decode_enc['session_id'];
if ($session_id) {
$session_arr = explode('|', $session_id);
$session_id = $session_arr[0];
$time = $session_arr[1];
if (time() - (int) $time > 3600) {
//超時
logger::error('微信登錄失敗!超時.' . var_export($_GET, 1) . var_export($decode_enc, 1));
$this->display('mobile/wxloginerror.html');
exit;
}
vmc::singleton('base_session')->set_sess_id($session_id);
vmc::singleton('base_session')->start();
vmc::singleton('b2c_user_object')->set_member_session($member_id);
$member_id = vmc::singleton('b2c_user_object')->get_member_session();
$member = app::get('b2c')->model('members')->dump($member_id);
if ($member) {
$this->pagedata['member'] = $member;
$this->display('mobile/wxloginsuccess.html');
} else {
logger::error('微信登錄失敗!未知會員數據.' . var_export($_GET, 1) . var_export($decode_enc['session_id'], 1));
$this->display('mobile/wxloginerror.html');
}
} else {
logger::error('微信登錄失敗!未知SESSION_ID.' . var_export($_GET, 1) . var_export($decode_enc['session_id'], 1));
$this->display('mobile/wxloginerror.html');
}
}
示例3: 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;
}
示例4: send
public function send($target, $title, $content, $config)
{
$tmpl_data = $config['tmpl_data'];
$action_name = $config['action_name'];
$action_name_alias = $config['action_name_alias'];
$new_msg = array('member_id' => $target['member_id'], 'target' => $target['mobile'], 'subject' => $title, 'content' => $content . $this->platform_config['sms_sign'], 'createtime' => time(), 'msg_type' => 'sms', 'status' => 'sent');
app::get('b2c')->model('member_msg')->save($new_msg);
if (!$target['mobile']) {
return false;
}
if (empty($this->platform_config['url']) || empty($this->platform_config['params_tmpl'])) {
return false;
}
$args = array('target' => $target['mobile'], 'content' => $content . $this->platform_config['sms_sign'], 'tmpl_data' => json_encode($tmpl_data), 'time' => date('Y-m-d H:i:s'), 'action' => $action_name, 'action_alias' => $action_name_alias);
//需要獲得access_token
if (!empty($this->platform_config['access_token_action'])) {
if (!($args['access_token'] = $this->get_access_token($this->platform_config['access_token_action']))) {
logger::error($this->platform_config['name'] . 'access_token獲得失敗,無法調用短信發送API');
return false;
}
}
$params = $this->gen_params($this->platform_config['params_tmpl'], $args);
$result = $this->net->post($this->platform_config['url'], $params);
logger::debug(__CLASS__ . $this->platform_config['url']);
logger::debug(var_export($params, 1));
logger::debug(var_export($result, 1));
return true;
}
示例5: __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]);
}
示例6: call
public function call($method, $params, $appId)
{
$prismHost = config::get('prism.prismHostUrl');
$prismSocketFile = config::get('prism.prismSocketFile');
//獲取應用對應的key和secret
$keySecret = apiUtil::getPrismKey($appId);
$key = $keySecret['key'];
$secret = $keySecret['secret'];
//獲取path
$path = apiUtil::genApiPath($method);
//params加入係統數據
$systemParams = $this->__genSystemParams($method);
$params = array_merge($params, $systemParams);
$params['method'] = $method;
//實例化請求工具
$client = new base_prism_client($prismHost, $key, $secret, $prismSocketFile);
//$path = "/api/bbc?method=bbc.test";
$result = $client->post($path, $params);
//日誌記錄
//之前request和response分開記錄的,發現不容易找,隻好放一起了
logger::info('call API : ' . $method . "\n" . 'wiht host : ' . $prismHost . "\n" . 'wiht key : ' . $key . "\n" . 'wiht secret : ' . $secret . "\n" . 'with params :' . var_export($params, 1) . "\n" . 'api result : ' . $result . "\n");
//這裏是返回數據
$result = json_decode($result, 1);
if ($result['error'] == null) {
return $result['result'];
} else {
//根據返回的數據是否錯誤,如果有錯誤,盡量以原有異常拋出
$exception = $result['error']['exception'] ? $result['error']['exception'] : 'Exception';
logger::error(var_export($result, 1));
$e = new $exception($result['error']['message']);
throw $e;
}
}
示例7: exec
/**
* 訂單創建完成時
* @params array - 訂單完整數據,含ITEMS
* @return boolean - 執行成功與否
*/
public function exec($sdf, &$msg = '')
{
logger::debug($sdf['order_id'] . 'createfinish exec');
if ($sdf['is_cod'] == 'Y') {
$freeze_data = array();
foreach ($sdf['items'] as $key => $item) {
//購買數量計數
vmc::singleton('b2c_openapi_goods', false)->counter(array('goods_id' => $item['goods_id'], 'buy_count' => $item['nums'], 'buy_count_sign' => md5($item['goods_id'] . 'buy_count' . $item['nums'] * 1024)));
//組織庫存凍結數據
$freeze_data[] = array('sku' => $item['bn'], 'quantity' => $item['nums']);
}
//庫存凍結
if (!vmc::singleton('b2c_goods_stock')->freeze($freeze_data, $msg)) {
logger::error('庫存凍結異常!ORDER_ID:' . $sdf['order_id'] . ',' . $msg);
}
}
/* 訂單金額為0 **/
$order_sdf = $sdf;
if ($order_sdf['order_total'] == '0') {
// 生成支付賬單
$obj_bill = vmc::singleton('ectools_bill');
$bill_sdf = array('bill_type' => 'payment', 'pay_object' => 'order', 'pay_mode' => in_array($order_sdf['pay_app'], array('-1', 'cod', 'offline')) ? 'offline' : 'online', 'order_id' => $order_sdf['order_id'], 'pay_app_id' => $order_sdf['pay_app'], 'pay_fee' => $order_sdf['cost_payment'], 'member_id' => $order_sdf['member_id'], 'status' => 'succ', 'money' => $order_sdf['order_total'], 'memo' => '訂單0元時自動生成');
if (!$obj_bill->generate($bill_sdf, $msg)) {
//TODO 自動支付失敗,
logger::error('訂單0元時自動支付失敗!' . $msg);
return;
}
}
return true;
}
示例8: __construct
function __construct($app)
{
$this->app = $app;
$this->sitemap = app::get('wap')->getConf('sitemaps');
// print_r($this->sitemap);exit;
if (!is_array($this->sitemap)) {
$sitemap_config = kernel::single('wap_module_base')->assemble_config();
if (is_array($sitemap_config)) {
$this->sitemap = $sitemap_config;
//todo:兼容kvstroe出錯的情況下
if (!kernel::single('wap_module_base')->write_config($sitemap_config)) {
logger::error('Error: sitemap can\'t save to kvstore');
//todo:如果寫入失敗,記錄於係統日誌中,前台不報錯,保證網站運行正常
}
} else {
//if false
trigger_error('sitemap is lost!', E_USER_ERROR);
//todo:無sitemap時報錯
}
}
foreach ($this->sitemap as $part => $controller) {
$urlmap[$controller[0] . ':' . $controller[1]] = $part;
if ($controller[3]) {
$extmap[$part] = '.' . $controller[3];
}
}
$this->urlmap = $urlmap;
$this->extmap = $extmap;
$this->_request = kernel::single('base_component_request');
$this->_response = kernel::single('base_component_response');
}
示例9: check
/**
* Check the given plain value against a hash.
*
* @param string $value
* @param string $hashedValue
* @param array $options
* @return bool
*/
public static function check($value, $hashedValue, base_hashing_hasher_interface $hasher = null)
{
if (!$hasher) {
$hasher = kernel::single('base_hashing_hasher_bcrypt');
}
logger::error(var_export(array($value, $hashedValue), 1));
return $hasher->check($value, $hashedValue);
}
示例10: exec
/**
* 訂單發貨操作完成時.
*
* @delivery_sdf array - 發貨單據SDF
* @msg 異常消息
*
* @return bool - 執行成功與否
*/
public function exec($delivery_sdf, &$msg = '')
{
$order_id = $delivery_sdf['order_id'];
if (!$order_id) {
$msg = '未知訂單id';
return false;
}
$all_send = true;
$order_items = app::get('b2c')->model('order_items')->getList('*', array('order_id' => $order_id));
$order_items = utils::array_change_key($order_items, 'item_id');
foreach ($delivery_sdf['delivery_items'] as $item) {
$order_items[$item['order_item_id']]['sendnum'] += $item['sendnum'];
if ($order_items[$item['order_item_id']]['sendnum'] > $order_items[$item['order_item_id']]['nums']) {
$msg = '發貨異常,超出應發數量';
return false;
}
if ($order_items[$item['order_item_id']]['sendnum'] < $order_items[$item['order_item_id']]['nums']) {
$all_send = false;
//部分發貨
}
}
$order_sdf = array('order_id' => $order_id, 'items' => $order_items, 'ship_status' => $all_send ? '1' : '2');
if (!app::get('b2c')->model('orders')->save($order_sdf)) {
$msg = '訂單狀態修改失敗!';
return false;
}
//庫存凍結釋放,真實扣除庫存
$stock_data = array();
foreach ($delivery_sdf['delivery_items'] as $key => $value) {
$stock_data[] = array('sku' => $value['bn'], 'quantity' => $value['sendnum']);
}
if (!vmc::singleton('b2c_goods_stock')->unfreeze($stock_data, $msg)) {
logger::error('庫存凍結釋放異常!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
}
if (!vmc::singleton('b2c_goods_stock')->delivery($stock_data, $msg)) {
logger::error('庫存扣減異常!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
}
//訂單日誌記錄
vmc::singleton('b2c_order_log')->set_operator(array('ident' => $delivery_sdf['op_id'], 'model' => 'shopadmin', 'name' => '操作員'))->set_order_id($order_sdf['order_id'])->success('shipment', '訂單' . (!$all_send ? '部分' : '') . '發貨成功!', $delivery_sdf);
/*
* 消息通知
* @args1 事件名稱
* @args2 消息模板數據填充
* @args3 消息目標
*/
$pam_data = vmc::singleton('b2c_user_object')->get_pam_data('*', $delivery_sdf['member_id']);
logger::debug('pam_data' . var_export($pam_data, 1));
$dlycorp = app::get('b2c')->model('dlycorp')->dump($delivery_sdf['dlycorp_id']);
$consignee_area = $delivery_sdf['consignee']['area'];
$consignee_area = explode(':', $consignee_area);
$consignee_area = $consignee_area[1];
//消息模板參數
$env_list = array('order_id' => $delivery_sdf['order_id'], 'consignee_name' => $delivery_sdf['consignee']['name'], 'consignee_area' => $consignee_area, 'consignee_addr' => $delivery_sdf['consignee']['addr'], 'consignee_tel' => $delivery_sdf['consignee']['tel'], 'consignee_mobile' => $delivery_sdf['consignee']['mobile'], 'dlycorp_name' => $dlycorp['name'], 'dlycorp_code' => $dlycorp['corp_code'], 'dlycorp_website' => $dlycorp['website'], 'logistics_no' => $delivery_sdf['logistics_no'], 'timestr' => date('Y-m-d H:i:s', $delivery_sdf['last_modify']));
vmc::singleton('b2c_messenger_stage')->trigger('orders-shipping', $env_list, array('mobile' => $pam_data['mobile'] ? $pam_data['mobile']['login_account'] : $order_sdf['consignee']['mobile'], 'email' => $pam_data['email'] ? $pam_data['email']['login_account'] : $order_sdf['consignee']['email'], 'member_id' => $delivery_sdf['member_id']));
return true;
}
示例11: error_handler
function error_handler($code, $msg, $file, $line)
{
if ($code == ($code & (E_ERROR ^ E_USER_ERROR ^ E_USER_WARNING))) {
logger::error(sprintf('ERROR:%d @ %s @ file:%s @ line:%d', $code, $msg, $file, $line));
if ($code == ($code & (E_ERROR ^ E_USER_ERROR))) {
exit;
}
}
return true;
}
示例12: loadModule
public function loadModule($moduleName)
{
$moduleName .= "Action";
$class_file = $this->getLocation($moduleName);
try {
require_once $class_file;
} catch (Exception $ex) {
logger::error("can not load module" . $class_file, $ex, "ModuleLoader");
}
$mod_obj = new $moduleName();
return $mod_obj;
}
示例13: call
public function call($conn, $path, $params, $method_type = 'get')
{
$caller = new PrismClient($conn['host'], $conn['key'], $conn['secret']);
if (in_array($method_type, array('get', 'post', 'delete', 'put'))) {
$result = call_user_func_array(array($caller, $method_type), array($path, $params));
}
$result = json_decode($result, true);
if ($result['error'] != null) {
logger::error(var_export(['conn' => $conn, 'path' => $path, 'params' => $params, 'method' => $method_type, 'result' => $result], 1));
throw new RuntimeException($result['error']['code'] . ':' . $result['error']['message'], $result['error']['code']);
}
return $result['result'];
}
示例14: register
static function register($data = null)
{
$sys_params = base_setup_config::deploy_info();
$code = md5(microtime());
base_kvstore::instance('ecos')->store('net.handshake', $code);
$app_exclusion = app::get('base')->getConf('system.main_app');
/** 得到框架的總版本號 **/
$obj_apps = app::get('base')->model('apps');
$tmp = $obj_apps->getList('*', array('app_id' => 'base'));
$app_xml = $tmp[0];
$app_xml['version'] = $app_xml['local_ver'];
if (defined('CERTIFICATE_SAS') && constant('CERTIFICATE_SAS')) {
$data = array('certi_app' => 'open.reg', 'app_id' => 'ecos.' . $app_exclusion['app_id'], 'url' => $data ? $data : kernel::base_url(1), 'result' => $code, 'version' => $app_xml['version']);
} else {
$conf = base_setup_config::deploy_info();
$data = array('certi_app' => 'open.reg', 'identifier' => base_enterprise::ent_id(), 'password' => base_enterprise::ent_ac(), 'product_key' => $conf['product_key'], 'url' => $data ? $data : kernel::base_url(1), 'result' => $code, 'version' => $app_xml['version'], 'api_ver' => '1.3');
}
$http = kernel::single('base_httpclient');
$http->set_timeout(6);
$result = $http->post(LICENSE_CENTER, $data);
//todo: 聲稱獲取一個唯一iD,發給飛飛
$result = json_decode($result, 1);
if ($result['res'] == 'succ') {
if ($result['info']) {
/*
if ($result['info']['node_id'])
{
$arr_shop_node_id = array(
'node_id' => $result['info']['node_id'],
);
base_shopnode::set_node_id($arr_shop_node_id,$app_exclusion['app_id']);
unset($result['info']['node_id']);
}
*/
//1.3接口不再返回node_id信息
base_shopnode::register($app_exclusion['app_id']);
$certificate = $result['info'];
$flag = self::set_certificate($certificate);
if ($flag) {
app::get('base')->setConf('certificate_code_url', $data['url']);
return true;
} else {
return false;
}
}
} else {
//throw new Exception(LICENSE_CENTER." return ".$result['res']."error is-- ".$result['code'].",".$result['msg']);
logger::error('create certificate_id faile, reason:' . LICENSE_CENTER . " return " . $result['res'] . "error is " . $result['code'] . "," . $result['msg'], false, LOG_ERR);
return false;
}
}
示例15: command_create
function command_create($project_name)
{
$options = $this->get_options();
$options['template'] = $options['template'] ? $options['template'] : 'dev_app';
list($template, $template_args) = explode(':', $options['template']);
$project_prototype = kernel::single($template);
$project_path = $project_prototype->init($project_name, $template_args);
if ($project_path) {
$project = array('name' => $project_name, 'path' => $project_path, 'createtime' => time(), 'type' => $options['template']);
dev_project::save($project);
logger::info('Write project info... ok.');
} else {
logger::error('error.');
}
}