当前位置: 首页>>代码示例>>PHP>>正文


PHP Log::write方法代码示例

本文整理汇总了PHP中Log::write方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::write方法的具体用法?PHP Log::write怎么用?PHP Log::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Log的用法示例。


在下文中一共展示了Log::write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     if ($this->config->get('amazon_status') != '1') {
         return;
     }
     $this->load->model('openbay/amazon_product');
     $logger = new Log('amazon.log');
     $logger->write('amazon/listing_reports - started');
     $token = $this->config->get('openbay_amazon_token');
     $incomingToken = isset($this->request->post['token']) ? $this->request->post['token'] : '';
     if ($incomingToken !== $token) {
         $logger->write('amazon/listing_reports - Incorrect token: ' . $incomingToken);
         return;
     }
     $decrypted = $this->openbay->amazon->decryptArgs($this->request->post['data']);
     if (!$decrypted) {
         $logger->write('amazon/listing_reports - Failed to decrypt data');
         return;
     }
     $logger->write('Received Listing Report: ' . $decrypted);
     $request = json_decode($decrypted, 1);
     $data = array();
     foreach ($request['products'] as $product) {
         $data[] = array('marketplace' => $request['marketplace'], 'sku' => $product['sku'], 'quantity' => $product['quantity'], 'asin' => $product['asin'], 'price' => $product['price']);
     }
     if ($data) {
         $this->model_openbay_amazon_product->addListingReport($data);
     }
     $this->model_openbay_amazon_product->removeListingReportLock($request['marketplace']);
     $logger->write('amazon/listing_reports - Finished');
 }
开发者ID:kashifnasim,项目名称:nexexcel,代码行数:31,代码来源:listing_report.php

示例2: error

 function error($f3)
 {
     $log = new Log('error.log');
     $log->write($f3->get('ERROR.text'));
     foreach ($f3->get('ERROR.trace') as $frame) {
         if (isset($frame['file'])) {
             // Parse each backtrace stack frame
             $line = '';
             $addr = $f3->fixslashes($frame['file']) . ':' . $frame['line'];
             if (isset($frame['class'])) {
                 $line .= $frame['class'] . $frame['type'];
             }
             if (isset($frame['function'])) {
                 $line .= $frame['function'];
                 if (!preg_match('/{.+}/', $frame['function'])) {
                     $line .= '(';
                     if (isset($frame['args']) && $frame['args']) {
                         $line .= $f3->csv($frame['args']);
                     }
                     $line .= ')';
                 }
             }
             // Write to custom log
             $log->write($addr . ' ' . $line);
         }
     }
     Template::instance()->render('error.html');
 }
开发者ID:paspo,项目名称:installinux,代码行数:28,代码来源:misc.php

示例3: error_handler

/**
 * Error handler, called when an error occurs
 *
 * @param int $errno	Error code
 * @param int $errstr	Error message
 * @param int $errfile	File in which the error occured
 * @param int $errline	Line of the file where the error occured
 */
function error_handler($errno, $errstr, $errfile, $errline)
{
    $log = new Log('php_errors.log');
    $msg = '';
    $exception = true;
    // cf. http://www.php.net/manual/en/function.set-error-handler.php
    switch ($errno) {
        case E_ERROR:
        case E_USER_ERROR:
            $msg = 'Fatal error: ' . $errstr . ' in ' . $errfile . ':' . $errline;
            $log->write($msg);
            if (Config::DEBUG) {
                return $msg;
            } else {
                return 'An error occured, please try again later.';
            }
            break;
        case E_WARNING:
        case E_USER_WARNING:
            $msg = 'Warning: ' . $errstr . ' in ' . $errfile . ':' . $errline;
            break;
        case E_NOTICE:
        case E_USER_NOTICE:
            $msg = 'Notice: ' . $errstr . ' in ' . $errfile . ':' . $errline;
            $exception = false;
            break;
        default:
            $msg = 'Unknown error [' . $errno . ']: ' . $errstr . ' in ' . $errfile . ':' . $errline;
            break;
    }
    $log->write($msg);
    if ($exception) {
        throw new Exception($msg, $errno);
    }
}
开发者ID:Godefroy,项目名称:confeature,代码行数:43,代码来源:init.php

示例4: logger

 public function logger($message)
 {
     if ($this->config->get('g2apay_debug') == 1) {
         $log = new Log('g2apay.log');
         $backtrace = debug_backtrace();
         $log->write('Origin: ' . $backtrace[6]['class'] . '::' . $backtrace[6]['function']);
         $log->write(print_r($message, 1));
     }
 }
开发者ID:brunoxu,项目名称:mycncart,代码行数:9,代码来源:g2apay.php

示例5: index

 public function index()
 {
     if ($this->config->get('amazon_status') != '1') {
         return;
     }
     $this->load->library('log');
     $this->load->library('amazon');
     $this->load->model('amazon/listing');
     $this->load->model('amazon/product');
     $logger = new Log('amazon_listing.log');
     $logger->write('amazon/listing - started');
     $token = $this->config->get('openbay_amazon_token');
     $incomingToken = isset($this->request->post['token']) ? $this->request->post['token'] : '';
     if ($incomingToken !== $token) {
         $logger->write('amazon/listing - Incorrect token: ' . $incomingToken);
         return;
     }
     $decrypted = $this->openbay->amazon->decryptArgs($this->request->post['data']);
     if (!$decrypted) {
         $logger->write('amazon/order Failed to decrypt data');
         return;
     }
     $data = json_decode($decrypted, 1);
     $logger->write("Received data: " . print_r($data, 1));
     if ($data['status']) {
         $logger->write("Updating " . $data['product_id'] . ' from ' . $data['marketplace'] . ' as successful');
         $this->model_amazon_listing->listingSuccessful($data['product_id'], $data['marketplace']);
         $this->model_amazon_product->linkProduct($data['sku'], $data['product_id']);
         $logger->write("Updated successfully");
     } else {
         $logger->write("Updating " . $data['product_id'] . ' from ' . $data['marketplace'] . ' as failed');
         $this->model_amazon_listing->listingFailed($data['product_id'], $data['marketplace'], $data['messages']);
         $logger->write("Updated successfully");
     }
 }
开发者ID:bamboo0079,项目名称:shopcart,代码行数:35,代码来源:listing.php

示例6: post_resetlogin

 public function post_resetlogin()
 {
     $validatekey = Str::random(32, 'alpha');
     $uname = Str::random(16, 'alpha');
     $user = Admin_User::find(Auth::user()->userid);
     $user->username = $uname;
     $user->password = $uname;
     $user->status = 3;
     $user->validationkey = $validatekey;
     $user->save();
     try {
         $mailer = Message::to($user->userprofile->emel);
         $mailer->from('admin@3fresorces.com', 'System Generate');
         $mailer->subject('Account Reset');
         $mailer->body('view: plugins.emailAccReset');
         $mailer->body->username = $uname;
         $mailer->body->password = $uname;
         $mailer->body->key = $key;
         $mailer->html(true);
         $mailer->send();
     } catch (Exception $e) {
         Log::write('email', 'Message was not sent.');
         Log::write('email', 'Mailer error: ' . $e->getMessage());
     }
 }
开发者ID:jigeeshup,项目名称:bootstrap-base-application,代码行数:25,代码来源:user.php

示例7: halt

/**
 * [halt 终止]
 * @Author   Rukic
 * @DateTime 2015-11-13T18:48:15+0800
 * @return   [type]                   [description]
 */
function halt($error, $level = "ERROR", $type = 3, $dest = NULL)
{
    if (is_array($error)) {
        Log::write($error['message'], $level, $type, $dest);
    } else {
        Log::write($error, $level, $type, $dest);
    }
    $e = array();
    //开启DEBUG
    if (DEBUG) {
        if (!is_array($error)) {
            $trace = debug_backtrace();
            //文件来源,追踪引导
            $e['message'] = $error;
            $e['file'] = $trace[0]['file'];
            $e['line'] = $trace[0]['line'];
            $e['class'] = isset($trace[0]['line']) ? $trace[0]['line'] : "";
            $e['function'] = isset($trace[0]['function']) ? $trace[0]['function'] : "";
            ob_start();
            debug_print_backtrace();
            $e['trace'] = htmlspecialchars(ob_get_clean());
        } else {
            $e = $error;
        }
    } else {
        if ($url = C('ERROR_URL')) {
            go($url);
        } else {
            $e['message'] = C('ERROR_MSG');
        }
    }
    include MYPHP_TPL_PATH . '/halt.html';
    die;
}
开发者ID:sujinw,项目名称:webPHP,代码行数:40,代码来源:function.php

示例8: logger

 public function logger($message)
 {
     if ($this->config->get('globalpay_debug') == 1) {
         $log = new Log('globalpay.log');
         $log->write($message);
     }
 }
开发者ID:brunoxu,项目名称:mycncart,代码行数:7,代码来源:globalpay.php

示例9: body

 public function body($disclaimer = false)
 {
     $data = '';
     $ok = false;
     while (!$ok && $this->attempts() > 0) {
         $data = $this->execute_query();
         if (!is_int($data)) {
             $ok = true;
         }
     }
     if (!$ok) {
         \Log::write('error', 'connexion: ' . $this->host() . ' -> ' . $this->get_query_string());
     }
     if (!$data) {
         if (count(explode('.', $this->domain)) >= 3) {
             $data = 'This Domain is not available in our whois database';
         } else {
             $data = 3;
         }
     }
     if (!is_int($data)) {
         $this->body = $data . "\n";
     } else {
         $this->body = $data;
     }
     if (!$disclaimer || $this->connection_type === 'curl') {
         $this->remove_surplus();
     }
     return $this->body;
 }
开发者ID:jinguanio,项目名称:whois,代码行数:30,代码来源:lktld.php

示例10: requestForTranslation

 /**
  * requestForTranslation method
  * called after Plugin.SourcePush event is dispatched
  *
  * @param array int id of new sources, target languages
  * @return void
  */
 public function requestForTranslation($event)
 {
     foreach ($event->data['newSources'] as $eventData) {
         $sourceId = $eventData[0];
         $targetLanguageId = $eventData[1];
         // get all the data
         $source = TableRegistry::get('sources')->findById($sourceId)->first();
         $sourceLanguage = TableRegistry::get('languages')->findById($source->language_id)->first();
         $targetLanguage = TableRegistry::get('languages')->findById($targetLanguageId)->first();
         // select suitable translators
         $translators = $this->SelectTranslator->selectTranslators($source->id, $targetLanguage->id);
         if (empty($translators)) {
             continue;
         }
         foreach ($translators as $translator) {
             // file in translation requests
             $translationRequest = $this->createTranslationRequest($translator, $source, $targetLanguage);
             if ($translationRequest === false) {
                 Log::write('newSource', 'createTranslationRequest fail: source:id = ' . $source->id . '; user_id = ' . $translator['id'] . '; targetLanguage_id = ' . $targetLanguage->id);
                 continue;
             }
             // notify translators about the requests
             $this->getMailer('translation')->send('translationRequest', [$source, $translator, $translationRequest['hash'], $sourceLanguage, $targetLanguage]);
         }
         // do machine translation
     }
 }
开发者ID:edasubert,项目名称:tweeslate,代码行数:34,代码来源:NewSourcesController.php

示例11: send

 public static function send($msg, $detail, $level = self::USER, $mobile = null)
 {
     //判断是否定义需要发送短信
     if (!in_array($level, explode(',', C('SMS_LEVEL')))) {
         return;
     }
     //判断发送频率
     $mc = memcache_init();
     $is_send = $mc->get('think_sms_send');
     //如果已经发送,则不发送
     if ($is_send === 'true') {
         $status = 'not send';
     } else {
         //TODU,如果apibus类调整,此类也得调整
         $sms = apibus::init('sms');
         if (is_null($mobile)) {
             $mobile = C('SMS_MOBILE');
         }
         $mc = memcache_init();
         $obj = $sms->send($mobile, mb_substr(C('SMS_SIGN') . $msg, 0, 65, 'utf-8'), "UTF-8");
         if ($sms->isError($obj)) {
             $status = 'failed';
         } else {
             $status = 'success';
             $mc->set('think_sms_send', 'true', 0, C('SMS_INTERVAL'));
         }
     }
     //记录日志
     if (C('LOG_RECORD')) {
         Log::record($msg . ';detail:' . $detail . '【status:' . $status . '】', 'SEND_SMS', true);
     } else {
         Log::write($msg . ';detail:' . $detail . '【status:' . $status . '】', 'SEND_SMS');
     }
 }
开发者ID:zjstage,项目名称:ThinkPHP,代码行数:34,代码来源:Sms.class.php

示例12: error

 /**
  * Runtime errors that do not require immediate action but
  * should typically be logged and monitored.
  *
  * @param string $classname
  * @param string $message
  */
 public static function error($classname, $message)
 {
     if (LOG_LEVEL <= 400) {
         $message = Log::format('ERROR', $classname, $message);
         Log::write($message);
     }
 }
开发者ID:englund,项目名称:eitf05,代码行数:14,代码来源:log.php

示例13: searchWidget

 public function searchWidget($vercode = 0)
 {
     if (!$this->_widgetFac) {
         Log::write("WidgetSearch::searchWidget():_widgetFac is null", "log");
         return false;
     }
     $sql = $this->_widgetFac->getWidgeMemSql($vercode);
     if (!$sql || empty($sql)) {
         Log::write('WidgetSearch::searchWidget():getWidgeMemSql() sql is empty', 'log');
         $result = get_rsp_result(false, 'get widget mem sql failed');
         return $result;
     }
     $result = $this->_memcached->getSearchResult($sql);
     if ($result) {
         return $result;
     }
     $result = $this->_widgetFac->getWidgetProtocol();
     if (!$result) {
         Log::write('WidgetSearch::searchWidget():getWidgetProtocol() failed', 'log');
         $result = get_rsp_result(false, 'get widget protocol failed');
         return $result;
     }
     $result = json_encode($result);
     $bResult = $this->_memcached->setSearchResult($sql, $result);
     if (!$bResult) {
         Log::write('WidgetSearch::setSearchResult() failed', 'log');
     }
     return $result;
 }
开发者ID:vvcumt,项目名称:zk,代码行数:29,代码来源:WidgetSearch.class.php

示例14: process_message

function process_message($msg)
{
    echo "\n############ 信息日志开始 ###############\n";
    echo date('Y-m-d H:i:s') . "=====" . $msg->body;
    echo "\n############ 信息日志结束 ###############\n";
    //执行SQL语句
    $db_config = C("DB_CONFIG");
    $dbConn = new mysql();
    $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2], '');
    $dbConn->select_db($db_config["master1"][4]);
    $sql = $msg->body;
    $query = $dbConn->query($sql);
    if (!$query) {
        Log::write($sql, Log::ERR);
    } else {
        echo date('Y-m-d H:i:s') . '===== [ok] ', '=====', $sql, "\n";
        //确认消费OK
        $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
    }
    $dbConn->close();
    // Send a message with the string "quit" to cancel the consumer.
    if ($msg->body === 'quit') {
        $msg->delivery_info['channel']->basic_cancel($msg->delivery_info['consumer_tag']);
    }
}
开发者ID:ohjack,项目名称:newErp,代码行数:25,代码来源:notice_power_subscribe.php

示例15: connect

 /**
  * Check connection to soap server and return current timestamp on success. No authorization required - used simply for seting up the connection via proxy, firewall, http authentication etc...
  * @return string Current timestamp dd.mm.YYYY HH:ii:ss
  * @soap
  */
 public function connect()
 {
     $request = Yii::app()->request;
     $url = $request->getHostInfo() . $request->getUrl();
     Log::write('[' . __FUNCTION__ . '] OK - Connection succesfull via [' . $url . ']', self::LOGNAME);
     return 'OK - connection succesfull at [' . date('d.m.Y H:i:s') . ']';
 }
开发者ID:super-d2,项目名称:codeigniter_demo,代码行数:12,代码来源:SoapController.php


注:本文中的Log::write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。