當前位置: 首頁>>代碼示例>>PHP>>正文


PHP logger類代碼示例

本文整理匯總了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;
 }
開發者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:"&nbsp;";}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


注:本文中的logger類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。