• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Logging类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: send

 public function send($to, $subject, $message, $from = NULL, $attachments = NULL)
 {
     if ($attachments != NULL) {
         throw new ServiceException("INVALID_CONFIGURATION", "Default mailer does not support sending attachments");
     }
     if (Logging::isDebug()) {
         Logging::logDebug("Sending mail to [" . Util::array2str($to) . "]: [" . $message . "]");
     }
     if (!$this->enabled) {
         return;
     }
     $isHtml = stripos($message, "<html>") !== FALSE;
     $f = $from != NULL ? $from : $this->env->settings()->setting("mail_notification_from");
     $validRecipients = $this->getValidRecipients($to);
     if (count($validRecipients) === 0) {
         Logging::logDebug("No valid recipient email addresses, no mail sent");
         return;
     }
     $toAddress = '';
     $headers = $isHtml ? 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=utf-8' . "\r\n" : 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=utf-8' . "\r\n";
     $headers .= 'From:' . $f;
     if (count($validRecipients) == 1) {
         $toAddress = $this->getRecipientString($validRecipients[0]);
     } else {
         $headers .= PHP_EOL . $this->getBccHeaders($validRecipients);
     }
     mail($toAddress, $subject, $isHtml ? $message : str_replace("\n", "\r\n", wordwrap($message)), $headers);
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:28,代码来源:MailSender.class.php


示例2: writeLog

 /**
  * Writes the given log entry using the logger. Or writes it to stdout if logger is null.
  * 
  * @param int $level The level of the log entry
  * @param string $msg The message of the log entry
  * @param Logging $logger The logger object to use to log the message
  */
 public static function writeLog($level, $msg, $logger)
 {
     if ($logger == null) {
         printf("[Level: %d][Time: %s][IP: %s][Message: %s]", $level, date('d-m-Y H:i:s', time()), $_SERVER['REMOTE_ADDR'], $message);
         //            if ($level == LoggingImpl::LEVEL_ERROR) {
         //                die;
         //            }
     }
     $logger->logEntry($level, $msg);
     if ($level == LoggingImpl::LEVEL_ERROR) {
         die;
     }
 }
开发者ID:TheProjecter,项目名称:miscellaneousrepo,代码行数:20,代码来源:Helper.php


示例3: processAPI

 public function processAPI()
 {
     if ($this->sqlInjection($_SERVER['REQUEST_URI'])) {
         $log = new Logging();
         $log->lfile('/var/www/web1162/html/tankUp/log_error.txt');
         $log->lwrite("SQL_Injection?: " . $_SERVER['REQUEST_URI']);
         $log->lclose();
         return $this->_response("Unexpected Parameters", 400);
     }
     if ((int) method_exists($this, $this->endpoint) > 0) {
         return $this->_response($this->{$this->endpoint}($this->args));
     }
     return $this->_response("No Endpoint: {$this->endpoint}", 404);
 }
开发者ID:robertlange81,项目名称:Website,代码行数:14,代码来源:AbstractApi.php


示例4: GetDataByCoords

 public function GetDataByCoords($article, $distance, $sortBy, location $coords)
 {
     try {
         $log = new Logging();
         $log->lfile('/var/www/web1162/html/tankUp/log_debug.txt');
         $log->lwrite($article . $distance . $sortBy . $coords->latitude . $coords->longitude);
         $log->lclose();
         $param = new GetDataByCoordsRequest($article, $distance, $coords, $sortBy);
         $response = $this->__construct()->__soapCall("getDataByCoords", array($param));
         return $response->petrolStation;
     } catch (Exception $e) {
         // Umwandlung Soap-Exception zu HTTP
         return $e;
     }
 }
开发者ID:robertlange81,项目名称:Website,代码行数:15,代码来源:soapclient.php


示例5: __toString

 public function __toString()
 {
     //if show error or save in logfile
     $msg = "[{$this->code}]: {$this->message}\n";
     return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
     $config = new Config();
     if ($config->logfile == true) {
         $logfile = new Logging();
         $logfile->lwrite($msg);
         return "";
     }
     if ($config->showerror == true) {
         return $msg;
     }
 }
开发者ID:rajveerbeniwal,项目名称:rooms-dhkh,代码行数:15,代码来源:MyException.php


示例6: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         if ($controller->getId() != 'index' && $action->getId() != 'index') {
             $logging = new Logging();
             $app = Yii::app();
             $request = $app->getRequest();
             $user = $app->getUser();
             $logging->attributes = ['user_id' => $user->getState('id', 0), 'username' => $user->getState('username', '匿名'), 'request' => $request->getRequestUrl(), 'param' => $request->getParamString(), 'type' => $request->getRequestType(), 'controller' => $controller->getId(), 'action' => $action->getId(), 'time' => time(), 'date' => date('Y-m-d'), 'ip' => $request->getUserHostAddress()];
             $logging->save();
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:syxoasis,项目名称:wakfu-sae,代码行数:16,代码来源:AdminModule.php


示例7: processPost

 public function processPost()
 {
     $data = $this->request->data;
     if (!isset($data['to']) or !isset($data['title']) or !isset($data['msg']) or !isset($data['items'])) {
         throw $this->invalidRequestException("Data missing");
     }
     $to = $data['to'];
     $message = $data['msg'];
     $title = $data['title'];
     $items = $this->items($data['items']);
     if (count($items) == 0) {
         throw $this->invalidRequestException("Items missing");
     }
     if (Logging::isDebug()) {
         Logging::logDebug("SENDVIAEMAIL: Sending mail " . $to . ":" . Util::array2str($items));
     }
     $attachments = array();
     foreach ($items as $i) {
         $attachments[] = $i->internalPath();
     }
     //TODO stream
     if ($this->env->mailer()->send(array($to), $title, $message, NULL, $attachments)) {
         $this->response()->success(array());
     } else {
         $this->response()->error("REQUEST_FAILED", NULL);
     }
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:27,代码来源:SendViaEmailServices.class.php


示例8: onResponseSent

 public function onResponseSent()
 {
     if (!$this->settings->hasSetting("debug_log") or !$this->environment->request()) {
         return;
     }
     $path = $this->environment->request()->path();
     if (count($path) > 0 and strcasecmp($path[0], "debug") == 0) {
         return;
     }
     $log = $this->settings->setting("debug_log");
     $handle = @fopen($log, "a");
     if (!$handle) {
         Logging::logError("Could not write to log file: " . $log);
         return;
     }
     $trace = Logging::getTrace();
     try {
         foreach ($trace as $d) {
             fwrite($handle, Util::toString($d));
         }
         fclose($handle);
     } catch (Exception $e) {
         Logging::logError("Could not write to log file: " . $log);
         Logging::logException($e);
     }
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:26,代码来源:KloudspeakerBackend.class.php


示例9: StoreFile

function StoreFile($_visitor, $_browserId, $_partner, $_fullname, $_chatId)
{
    $filename = IOStruct::GetNamebase($_FILES['form_userfile']['name']);
    Logging::GeneralLog($filename);
    if (!IOStruct::IsValidUploadFile($filename)) {
        return false;
    }
    if (empty($_fullname)) {
        $_fullname = Visitor::GetNoName($_visitor->UserId . Communication::GetIP());
    }
    $fileid = md5($filename . $_visitor->UserId . $_browserId);
    $fileurid = EX_FILE_UPLOAD_REQUEST . "_" . $fileid;
    $filemask = $_visitor->UserId . "_" . $fileid;
    $request = new FileUploadRequest($fileurid, $_partner, $_chatId);
    $request->Load();
    if ($request->Permission == PERMISSION_FULL) {
        if (move_uploaded_file($_FILES["form_userfile"]["tmp_name"], PATH_UPLOADS . $request->FileMask)) {
            KnowledgeBase::CreateFolders($_partner, false);
            KnowledgeBase::Process($_partner, $_visitor->UserId, $_fullname, 0, $_fullname, 0, 5, 3);
            KnowledgeBase::Process($_partner, $fileid, $filemask, 4, $_FILES["form_userfile"]["name"], 0, $_visitor->UserId, 4, $_FILES["form_userfile"]["size"]);
            $request->Download = true;
            $request->Save();
            return true;
        } else {
            $request->Error = true;
            $request->Save();
        }
    }
    return false;
}
开发者ID:sgh1986915,项目名称:laravel-eyerideonline,代码行数:30,代码来源:upload.php


示例10: testImport

 public function testImport()
 {
     print "\n" . "Testing import ... ";
     $response = RequestResponse::ImportConceptRequest(self::$client, self::$postData, self::$boundaryNumeric);
     Logging::var_error_log("\n Response body ", $response->getBody(), __DIR__ . "/ImportResponse.html");
     $this->AssertEquals(200, $response->getStatus(), 'Failed to import concept');
     $output = array('0' => "The ouput of sending jobs: ");
     $retvar = 0;
     $sendjob = exec(PHP_JOBS_PROCESS, $output, $retvar);
     // check via spraql query
     //$sparqlResult = $this ->sparqlRetrieveTriplesForNotation(self::$notation);
     //var_dump($sparqlResult);
     self::$client->setUri(BASE_URI_ . '/public/api/find-concepts?q=prefLabel:' . self::$prefLabel);
     $responseGet = self::$client->request(Zend_Http_Client::GET);
     $this->AssertEquals(200, $responseGet->getStatus(), $responseGet->getMessage());
     $dom = new Zend_Dom_Query();
     $namespaces = RequestResponse::setNamespaces();
     $dom->registerXpathNamespaces($namespaces);
     $xml = $responseGet->getBody();
     $dom->setDocumentXML($xml);
     var_dump($xml);
     $results1 = $dom->query('rdf:RDF');
     $this->AssertEquals(1, $results1->current()->getAttribute('openskos:numFound'));
     $results2 = $dom->queryXpath('/rdf:RDF/rdf:Description');
     $this->AssertEquals(1, count($results2));
 }
开发者ID:OpenSKOS,项目名称:phpunittests,代码行数:26,代码来源:ImportConcept2Test.php


示例11: log

 function log()
 {
     if (!Logging::isDebug()) {
         return;
     }
     Logging::logDebug("PLUGIN (" . get_class($this) . ")");
 }
开发者ID:kumarsivarajan,项目名称:mollify,代码行数:7,代码来源:PluginBase.class.php


示例12: send

 public function send($to, $subject, $message, $from = NULL, $attachments = NULL)
 {
     if (!$this->enabled) {
         return;
     }
     $isHtml = stripos($message, "<html>") !== FALSE;
     $f = $from != NULL ? $from : $this->env->settings()->setting("mail_notification_from");
     $validRecipients = $this->getValidRecipients($to);
     if (count($validRecipients) === 0) {
         Logging::logDebug("No valid recipient email addresses, no mail sent");
         return;
     }
     if (Logging::isDebug()) {
         Logging::logDebug("Sending mail from [" . $f . "] to [" . Util::array2str($validRecipients) . "]: [" . $message . "]");
     }
     set_include_path("vendor/PHPMailer" . DIRECTORY_SEPARATOR . PATH_SEPARATOR . get_include_path());
     require 'class.phpmailer.php';
     $mailer = new PHPMailer();
     $smtp = $this->env->settings()->setting("mail_smtp");
     if ($smtp != NULL and isset($smtp["host"])) {
         $mailer->isSMTP();
         $mailer->Host = $smtp["host"];
         if (isset($smtp["username"]) and isset($smtp["password"])) {
             $mailer->SMTPAuth = true;
             $mailer->Username = $smtp["username"];
             $mailer->Password = $smtp["password"];
         }
         if (isset($smtp["secure"])) {
             $mailer->SMTPSecure = $smtp["secure"];
         }
     }
     $mailer->From = $f;
     foreach ($validRecipients as $recipient) {
         $mailer->addBCC($recipient["email"], $recipient["name"]);
     }
     if (!$isHtml) {
         $mailer->WordWrap = 50;
     } else {
         $mailer->isHTML(true);
     }
     if ($attachments != NULL) {
         //TODO use stream
         foreach ($attachments as $attachment) {
             $mailer->addAttachment($attachment);
         }
     }
     $mailer->Subject = $subject;
     $mailer->Body = $message;
     try {
         if (!$mailer->send()) {
             Logging::logError('Message could not be sent: ' . $mailer->ErrorInfo);
             return FALSE;
         }
         return TRUE;
     } catch (Exception $e) {
         Logging::logError('Message could not be sent: ' . $e);
         return FALSE;
     }
 }
开发者ID:kumarsivarajan,项目名称:mollify,代码行数:59,代码来源:PHPMailerSender.class.php


示例13: putToCache

 private function putToCache($name, $subject, $value)
 {
     if (!array_key_exists($name, $this->permissionCaches)) {
         $this->permissionCaches[$name] = array();
     }
     $this->permissionCaches[$name][$subject] = $value;
     Logging::logDebug("Permission cache put [" . $name . "/" . $subject . "]=" . $value);
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:8,代码来源:PermissionsController.class.php


示例14: chkCSRFToken

 /**
  * CSRF対策のトークンをチェックする。
  * 異常時はログに書き込む
  * @return boolean
  */
 static function chkCSRFToken($file = null, $line = null)
 {
     if (ENABLE_CSRF == TRUE) {
         return true;
     }
     if ($_POST) {
         // CSRF トークンが正しいかチェック
         if (\Security::check_token()) {
             return true;
         }
     }
     $msg2 = 'Invalid CSRF Token';
     //		Log::error($msg2);
     $log = new Logging();
     $log->writeLog_Warning($msg2, $file, $line);
     return false;
 }
开发者ID:katsuwo,项目名称:bbs,代码行数:22,代码来源:csrfcheck.php


示例15: getShareItem

 public function getShareItem($id)
 {
     $ic = $this->dao()->getItemCollection($id);
     if (!$ic) {
         Logging::logDebug("Invalid share request, no item collection found with id " . $id);
         return NULL;
     }
     return array("name" => $ic["name"]);
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:9,代码来源:ItemCollectionHandler.class.php


示例16: forward

 /**
  * Forward the user to a specified url
  *
  * @param string $url The URL to forward to
  * @param integer $code [optional] HTTP status code
  */
 public function forward($url, $code = 200)
 {
     if (Context::getRequest()->isAjaxCall() || Context::getRequest()->getRequestedFormat() == 'json') {
         $this->getResponse()->ajaxResponseText($code, Context::getMessageAndClear('forward'));
     }
     Logging::log("Forwarding to url {$url}");
     Logging::log('Triggering header redirect function');
     $this->getResponse()->headerRedirect($url, $code);
 }
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:15,代码来源:Action.php


示例17: getShareInfo

 public function getShareInfo($id, $share)
 {
     $ic = $this->dao()->getItemCollection($id);
     if (!$ic) {
         Logging::logDebug("Invalid share request, no item collection found with id " . $id);
         return NULL;
     }
     return array("name" => $ic["name"], "type" => "prepared_download");
 }
开发者ID:mobas,项目名称:mollify,代码行数:9,代码来源:ItemCollectionHandler.class.php


示例18: getBackend

 protected function getBackend()
 {
     Logging::initialize(self::$CONFIGURATION, "Test");
     $this->responseHandler = new TestResponseHandler();
     $db = PDODatabase::createFromObj(self::$pdo, "sqlite");
     $settings = new Settings(self::$CONFIGURATION);
     $backend = new MollifyBackend($settings, $db, $this->responseHandler);
     //$backend->processRequest(new Request());
     return $backend;
 }
开发者ID:mobas,项目名称:mollify,代码行数:10,代码来源:TestCase.php


示例19: run

 public function run()
 {
     $log = new Logging();
     //        $parenClass = new ParentClass();
     // set path and name of log file (optional)
     $log->lfile('log.txt');
     $json = file_get_contents('php://input');
     $log->lwrite("post: " . $json);
     $update = new Update($json);
     $message = $update->getMessage();
     $chat = $message->getChat();
     $chat_id = $chat->getId();
     $text = $message->getText();
     $client = new Client();
     $client->sendMessage($chat_id, $text, null, null, null);
     $client->sendLocation($chat_id, 53.480759, -2.242631, null, null);
     $client->sendPhoto($chat_id, 'pic.jpg', 'sweety', null, null);
     $log->lclose();
 }
开发者ID:raniongolu,项目名称:Telegram-Bot-Client,代码行数:19,代码来源:index.php


示例20: search

 public function search($begin, $end)
 {
     $condition = 'time>=:begin AND time<=:end';
     $params = ['begin' => $begin, 'end' => $end];
     $model = Logging::model();
     $pager = new CPagination($model->count($condition, $params));
     $pager->setPageSize(100);
     $logging = $model->findAll(['condition' => $condition, 'params' => $params, 'offset' => $pager->getOffset(), 'limit' => $pager->getLimit(), 'order' => 'time desc']);
     $this->render('index', ['logging' => new RedArrayDataProvider($logging), 'pager' => $pager]);
 }
开发者ID:syxoasis,项目名称:wakfu-sae,代码行数:10,代码来源:LoggingController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP LogicException类代码示例发布时间:2022-05-23
下一篇:
PHP LoggerOptionConverter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap