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


PHP Helpers::getSource方法代码示例

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


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

示例1: log

 public function log($message, $priority = self::INFO)
 {
     $context = ['at' => Helpers::getSource()];
     if ($message instanceof Throwable) {
         $context['exception'] = $message;
         $message = '';
     }
     $this->monolog->addRecord(self::PRIORITY_MAP[$priority] ?? Monolog\Logger::ERROR, $message, $context);
 }
开发者ID:nextras,项目名称:tracy-monolog-adapter,代码行数:9,代码来源:Logger.php

示例2: render

 /**
  * Renders blue screen.
  * @param  \Exception
  * @return void
  */
 public function render(\Exception $exception)
 {
     $panels = $this->panels;
     $info = array_filter($this->info);
     $source = Helpers::getSource();
     $sourceIsUrl = preg_match('#^https?://#', $source);
     $title = $exception instanceof \ErrorException ? Helpers::errorTypeToString($exception->getSeverity()) : get_class($exception);
     $skipError = $sourceIsUrl && $exception instanceof \ErrorException && !empty($exception->skippable) ? $source . (strpos($source, '?') ? '&' : '?') . '_tracy_skip_error' : NULL;
     require __DIR__ . '/templates/bluescreen.phtml';
 }
开发者ID:enumag,项目名称:tracy,代码行数:15,代码来源:BlueScreen.php

示例3: formatLogLine

 /**
  * @return string
  */
 protected function formatLogLine($message, $exceptionFile = NULL)
 {
     return implode(' ', array(@date('[Y-m-d H-i-s]'), preg_replace('#\\s*\\r?\\n\\s*#', ' ', $this->formatMessage($message)), ' @  ' . Helpers::getSource(), $exceptionFile ? ' @@  ' . basename($exceptionFile) : NULL));
 }
开发者ID:enumag,项目名称:tracy,代码行数:7,代码来源:Logger.php

示例4: defaultMailer

 /**
  * Default mailer.
  *
  * @param $message
  * @param $email
  * @param  string|\Exception|\Throwable
  *
  * @internal
  */
 public function defaultMailer($message, $email, $exceptionFile = NULL, $priority = NULL)
 {
     if (!is_null($this->host)) {
         $host = $this->host;
     } else {
         $host = preg_replace('#[^\\w.-]+#', '', isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : php_uname('n'));
     }
     try {
         $emailSendJson = Nette\Utils\Json::decode(file_get_contents($this->directory . '/email-sent'), Nette\Utils\Json::FORCE_ARRAY);
     } catch (Nette\Utils\JsonException $e) {
         $emailSendJson = [];
     }
     $emailSendJson[$exceptionFile] = TRUE;
     @file_put_contents($this->directory . '/email-sent', Nette\Utils\Json::encode($emailSendJson));
     $mail = new Nette\Mail\Message();
     $mail->setFrom($this->fromEmail ?: (Nette\Utils\Validators::isEmail("noreply@{$host}") ? "noreply@{$host}" : "noreply@example.tld"))->addTo(is_array($email) ? $email[0] : $email)->setSubject("PHP: An error (" . $this->getTitle($message, $priority) . ") occurred on the server {$host}")->setHtmlBody($this->formatMessage($message) . "\n\nsource: " . Tracy\Helpers::getSource() . (is_null($exceptionFile) ? '' : "\n\nexception link: " . Nette\Utils\Strings::replace($exceptionFile, ['~^(.*)exception--~' => 'http://' . $host . $this->path . 'exception--'])));
     if (is_array($email)) {
         foreach ($email as $k => $v) {
             if ($k == 0) {
                 continue;
             }
             $mail->addCc($v);
         }
     }
     $this->mailerClass->send($mail);
 }
开发者ID:trejjam,项目名称:utils,代码行数:35,代码来源:Logger.php

示例5: defaultMailer

 /**
  * Default mailer.
  * @param  string
  * @param  string
  * @return void
  * @internal
  */
 public function defaultMailer($message, $email)
 {
     $host = preg_replace('#[^\\w.-]+#', '', isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : php_uname('n'));
     $parts = str_replace(array("\r\n", "\n"), array("\n", PHP_EOL), array('headers' => implode("\n", array("From: noreply@{$host}", 'X-Mailer: Tracy', 'Content-Type: text/plain; charset=UTF-8', 'Content-Transfer-Encoding: 8bit')) . "\n", 'subject' => "PHP: An error occurred on the server {$host}", 'body' => $this->formatMessage($message) . "\n\nsource: " . Helpers::getSource()));
     mail($email, $parts['subject'], $parts['body'], $parts['headers']);
 }
开发者ID:vladimirslevercz,项目名称:alena,代码行数:13,代码来源:Logger.php


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