本文整理汇总了PHP中logger类的典型用法代码示例。如果您正苦于以下问题:PHP logger类的具体用法?PHP logger怎么用?PHP logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了logger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:yindonghai,项目名称:msk.com,代码行数:44,代码来源:email.php
示例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;
}
开发者ID:Rajeshwar90,项目名称:Referralio,代码行数:34,代码来源:GCM.php
示例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;
}
}
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:33,代码来源:contrib_installer.php
示例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;
}
开发者ID:rrecurse,项目名称:IntenseCart,代码行数:12,代码来源:general.php
示例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;
}
开发者ID:zel777,项目名称:Responsive-osCommerce,代码行数:12,代码来源:database.php
示例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;
}
开发者ID:AlanR,项目名称:oscommerce2,代码行数:15,代码来源:general.php
示例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');
}
开发者ID:payneteasy,项目名称:php-plugin-oscommerce-2,代码行数:12,代码来源:sale_finisher.php
示例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 财付通双接口支付方式更新成功');
}
}
开发者ID:sss201413,项目名称:ecstore,代码行数:7,代码来源:task.php
示例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;
}
开发者ID:453111208,项目名称:bbc,代码行数:25,代码来源:server.php
示例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;
}
开发者ID:sss201413,项目名称:ecstore,代码行数:31,代码来源:transaction.php
示例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();
}
}
开发者ID:fabioassuncao,项目名称:build-a-blog,代码行数:37,代码来源:database.php
示例12: post_uninstall
public function post_uninstall()
{
$init = kernel::single('cps_init');
logger::info('Uninstall cps');
$inst = kernel::single('cps_theme_inst');
$inst->uninstTheme();
}
开发者ID:sss201413,项目名称:ecstore,代码行数:7,代码来源:task.php
示例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;
}
开发者ID:yindonghai,项目名称:msk.com,代码行数:35,代码来源:end.php
示例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);
}
}
开发者ID:lianren,项目名称:framework,代码行数:35,代码来源:common.php
示例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]);
}
开发者ID:noikiy,项目名称:Ecstore-to-odoo,代码行数:27,代码来源:response.php
示例16: __construct
public function __construct($esteBloque, $lenguaje = "") {
// El objeto de la clase Configurador debe ser único en toda la aplicación
$this->miConfigurador = \Configurador::singleton ();
$ruta = $this->miConfigurador->getVariableConfiguracion ( "raizDocumento" );
$rutaURL = $this->miConfigurador->getVariableConfiguracion ( "host" ) . $this->miConfigurador->getVariableConfiguracion ( "site" );
if (! isset ( $esteBloque ["grupo"] ) || $esteBloque ["grupo"] == "") {
$ruta .= "/blocks/" . $esteBloque ["nombre"] . "/";
$rutaURL .= "/blocks/" . $esteBloque ["nombre"] . "/";
} else {
$ruta .= "/blocks/" . $esteBloque ["grupo"] . "/" . $esteBloque ["nombre"] . "/";
$rutaURL .= "/blocks/" . $esteBloque ["grupo"] . "/" . $esteBloque ["nombre"] . "/";
}
$this->miConfigurador->setVariableConfiguracion ( "rutaBloque", $ruta );
$this->miConfigurador->setVariableConfiguracion ( "rutaUrlBloque", $rutaURL );
$this->miFuncion = new Funcion ();
$this->miSql = new Sql ();
$this->miFrontera = new Frontera ();
$this->miLenguaje = new Lenguaje ();
//Objeto de la clase Loger
$this->miLogger = \logger::singleton();
}
开发者ID:udistrital,项目名称:tike_desarrollo,代码行数:26,代码来源:bloque.php
示例17: sitemapAction
public function sitemapAction()
{
$this->removeViewRenderer();
$sitemapFile = $this->_getParam("sitemap");
if (strpos($sitemapFile, '/') !== FALSE) {
// / not allowed since site map file name is generated from domain name
throw new Exception(get_class($this) . ": Attempted access to invalid sitemap [ {$sitemapFile} ]");
}
header("Content-type: application/xml");
$requestedSitemap = PIMCORE_WEBSITE_PATH . "/var/search/sitemap/" . $sitemapFile;
$indexSitemap = PIMCORE_WEBSITE_PATH . "/var/search/sitemap/sitemap.xml";
if ($this->_getParam("sitemap") and is_file($requestedSitemap)) {
$content = file_get_contents($requestedSitemap);
//TODO: strlen($content) takes a few seconds!
//header("Content-Length: ".strlen($content));
echo $content;
exit;
} else {
if (is_file($indexSitemap)) {
$content = file_get_contents($indexSitemap);
//TODO: strlen($content) takes a few seconds!
//header("Content-Length: ".strlen($content));
echo $content;
exit;
} else {
logger::debug(get_class($this) . ": sitemap request - but no sitemap available to deliver");
exit;
}
}
}
开发者ID:weblizards-gmbh,项目名称:search-php,代码行数:30,代码来源:FrontendController.php
示例18: 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;
}
开发者ID:yindonghai,项目名称:msk.com,代码行数:28,代码来源:sms.php
示例19: get_slave_redis
public static function get_slave_redis($source_name)
{
if (!isset(self::$redis_nodes['slave'][$source_name])) {
$dsns = config::get_logic('redis.' . $source_name . '.slaves', []);
if ($dsns === []) {
$dsns = array(config::get_logic('redis.' . $source_name . '.master'));
}
$all_attempts_failed = true;
foreach ($dsns as $dsn) {
$url_parts = parse_url($dsn);
extract($url_parts, EXTR_SKIP);
$redis_node = new redis_slave_node();
if ($redis_node->connect($host, $port, 2)) {
self::$redis_nodes['slave'][$source_name] = $redis_node;
$all_attempts_failed = false;
break;
} else {
logger::log_error("cannot connect to dsn: '{$dsn}', maybe failed?");
}
}
if ($all_attempts_failed) {
throw new server_except("cannot connect to all dsns of redis source: {$source_name}");
}
}
return self::$redis_nodes['slave'][$source_name];
}
开发者ID:xpd1437,项目名称:swap,代码行数:26,代码来源:redis.php
示例20: 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;
}
}
开发者ID:453111208,项目名称:bbc,代码行数:33,代码来源:caller.php
注:本文中的logger类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论