本文整理汇总了PHP中newrelic_notice_error函数的典型用法代码示例。如果您正苦于以下问题:PHP newrelic_notice_error函数的具体用法?PHP newrelic_notice_error怎么用?PHP newrelic_notice_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了newrelic_notice_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: noticeError
/**
* Report an error at this line of code, with a complete stack trace.
*
* @param string $message
* @param \Exception|\Throwable $exception
*
* @return $this
*/
public function noticeError($message, $exception)
{
if ($this->active) {
newrelic_notice_error($message, $exception);
}
return $this;
}
开发者ID:spryker,项目名称:NewRelic,代码行数:15,代码来源:NewRelicApi.php
示例2: _write
/**
* Write the log message to the file path set
* in this writer.
*/
public function _write($event)
{
//Ignore Exceptions New Relic Catches these on it's own
if (preg_match('/Uncaught ([A-Za-z]*)Exception: /', trim($errstr)) == true) {
return;
}
$errno = $event['message']['errno'];
$errstr = $event['message']['errstr'];
$errfile = $event['message']['errfile'];
$errline = $event['message']['errline'];
$errcontext = $event['message']['errcontext'];
switch ($event['priorityName']) {
case 'ERR':
$errtype = 'Error';
break;
case 'WARN':
$errtype = 'Warning';
break;
case 'NOTICE':
$errtype = 'Notice';
break;
default:
$errtype = $event['priorityName'];
}
$relfile = Director::makeRelative($errfile);
if ($relfile && $relfile[0] == '/') {
$relfile = substr($relfile, 1);
}
//If it's not an exception notice the error
newrelic_notice_error($errno, "[{$errtype}] {$errstr} in {$relfile} line {$errline}", $errfile, $errline, $errcontext);
}
开发者ID:webbuilders-group,项目名称:silverstripe-new-relic,代码行数:35,代码来源:NewRelicErrorLogger.php
示例3: __invoke
/**
* @param \Nette\Application\Application $application
* @param \Exception|\Throwable $e
*/
public function __invoke(Application $application, $e)
{
if ($e instanceof \Nette\Application\BadRequestException) {
// skip 4xx errors
return;
}
newrelic_notice_error($e->getMessage(), $e);
}
开发者ID:vrtak-cz,项目名称:newrelic-nette,代码行数:12,代码来源:OnErrorCallback.php
示例4: onError
public function onError(Application $app, \Exception $e)
{
if ($e instanceof BadRequestException) {
return;
// ignore
}
newrelic_notice_error($e->getMessage(), $e);
}
开发者ID:bazo,项目名称:nette-newrelic-extension,代码行数:8,代码来源:NewRelicProfiler.php
示例5: onError
public function onError(Application $app, \Exception $e)
{
if (!extension_loaded('newrelic')) {
return;
}
if ($e instanceof Nette\Application\BadRequestException) {
return;
}
newrelic_notice_error($e->getMessage(), $e);
}
开发者ID:enumag,项目名称:newrelic-nette-1,代码行数:10,代码来源:NewRelicProfilingListener.php
示例6: log
protected function log($message, $type = 'notice', $exception = null)
{
$typeMap = array('error' => E_USER_ERROR, 'warning' => E_USER_WARNING, 'notice' => E_USER_NOTICE);
file_put_contents(dirname(__FILE__) . '/../../../../error.log', $message . $exception, FILE_APPEND);
error_log($message, $typeMap[$type]);
if (extension_loaded('newrelic')) {
newrelic_notice_error($message, $exception);
}
return $this;
}
开发者ID:jamwaffles,项目名称:pliers,代码行数:10,代码来源:App.php
示例7: handle
/**
* Handles a given exception
*
* @param Throwable|Exception $exception A Throwable or Exception instance
* @return void
*/
public function handle($exception)
{
$exception = call_user_func($this->config('exceptionCallback'), $exception);
if (!$exception) {
return;
}
if (extension_loaded('newrelic')) {
newrelic_notice_error($exception);
}
}
开发者ID:josegonzalez,项目名称:php-error-handlers,代码行数:16,代码来源:NewrelicHandler.php
示例8: log
public function log($message, $priority = self::INFO)
{
$res = parent::log($message, $priority);
if ($priority === self::ERROR || $priority === self::CRITICAL) {
if (is_array($message)) {
$message = implode(' ', $message);
}
newrelic_notice_error($message);
}
return $res;
}
开发者ID:enumag,项目名称:newrelic-nette-1,代码行数:11,代码来源:Logger.php
示例9: noticeError
/**
* {@inheritdoc}
*/
public function noticeError($message, $exception = null)
{
if (!$this->extensionLoaded()) {
return;
}
if (!$exception) {
newrelic_notice_error($message);
} else {
newrelic_notice_error($message, $exception);
}
}
开发者ID:neeckeloo,项目名称:newrelic,代码行数:14,代码来源:Client.php
示例10: pushEvent
/**
* Static since a store config exception (caused by a module config error) cannot call magento's model objects.
* If a store config exception occurs, the exception class logs it drect.
*
* @param type $e
*/
public static function pushEvent($e, $setAppName = true)
{
if (extension_loaded('newrelic')) {
$message = $e->getMessage();
$message = empty($message) ? get_class($e) : $message;
if ($setAppName) {
Mage::Helper('newrelic')->setAppName();
}
newrelic_notice_error($message, $e);
}
}
开发者ID:Bobspadger,项目名称:NewRelic,代码行数:17,代码来源:Exception.php
示例11: log
/**
* @param string|array $message
* @param string $priority
* @return string logged error filename
*/
public function log($message, $priority = NULL)
{
$exceptionFile = $this->oldLogger->log($message, $priority);
if (in_array($priority, $this->logLevels)) {
if (is_array($message)) {
$message = implode(' ', $message);
}
newrelic_notice_error($message);
}
return $exceptionFile;
}
开发者ID:vrtak-cz,项目名称:newrelic-tracy,代码行数:16,代码来源:Logger.php
示例12: recordEvent
/**
* Record a log event to new relic
*
* @param type $event
* @return type
*/
public function recordEvent($event)
{
if (extension_loaded('newrelic')) {
if (Mage::getStoreConfig('newrelic/settings/record_system_log') && !Mage::helper('newrelic')->ignoreMessage($event['message'], 'system_log')) {
if ($event['priorityName'] == 'DEBUG' && Mage::getStoreConfig('newrelic/settings/system_log_ignore_debug')) {
return;
}
Mage::Helper('newrelic')->setAppName();
newrelic_notice_error($this->_eventType . ': [' . $event['priorityName'] . '] ' . $event['message']);
}
}
}
开发者ID:Bobspadger,项目名称:NewRelic,代码行数:18,代码来源:System.php
示例13: log
public function log($message, $priority = self::INFO)
{
if (!extension_loaded('newrelic')) {
return;
}
if ($priority === self::ERROR || $priority === self::CRITICAL) {
if (is_array($message)) {
$message = implode(' ', $message);
}
newrelic_notice_error($message);
}
}
开发者ID:bazo,项目名称:nette-newrelic-extension,代码行数:12,代码来源:NewRelicLogger.php
示例14: noticeException
/**
* @param array $record
*/
private function noticeException(array &$record)
{
if (!empty($record['exception']) && $record['exception'] instanceof \Exception) {
newrelic_notice_error($record['exception']->getMessage(), $record['exception']);
unset($record['exception']);
} elseif (!empty($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) {
newrelic_notice_error($record['context']['exception']->getMessage(), $record['context']['exception']);
unset($record['context']['exception']);
} elseif (!empty($record['extra']['exception']) && $record['extra']['exception'] instanceof \Exception) {
newrelic_notice_error($record['extra']['exception']->getMessage(), $record['extra']['exception']);
unset($record['extra']['exception']);
} elseif (!empty($record['message'])) {
newrelic_notice_error($record['message']);
}
}
开发者ID:mobly,项目名称:logger,代码行数:18,代码来源:NewRelicHandler.php
示例15: write
/**
* @param array $record
* @throws Exception\RuntimeException
*/
public function write(array $record)
{
if (!$this->isEnabled()) {
throw new Exception\RuntimeException('The newrelic PHP extension is required to use the NewRelicHandler');
}
if ($name = $this->getName($record['context'])) {
$this->setName($name);
}
if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) {
newrelic_notice_error($record['message'], $record['context']['exception']);
unset($record['context']['exception']);
} else {
newrelic_notice_error($record['message']);
}
foreach ($record['context'] as $key => $parameter) {
newrelic_add_custom_parameter($key, $parameter);
}
}
开发者ID:sullenboom,项目名称:sla-healthcheck,代码行数:22,代码来源:Handler.php
示例16: onKernelException
public function onKernelException(GetResponseForExceptionEvent $event)
{
if ($this->thrownAnError) {
return;
// do not throw more than one error, since it is going to be overwritten
}
$exception = $event->getException();
if ($exception instanceof HttpExceptionInterface) {
return;
// we should only log non-http exceptions
}
if (!extension_loaded('newrelic')) {
return;
// the extension is not loaded
}
newrelic_notice_error(null, $exception);
$this->thrownAnError = true;
}
开发者ID:Zrgisa,项目名称:NewRelicBundle,代码行数:18,代码来源:ExceptionListener.php
示例17: handle
public function handle($type, $message, $file, $line, $extra)
{
if ($this->canIgnoreError($type)) {
return;
}
// Symfony HttpExceptionInterface status code filtering
if (isset($extra['code']) && $extra['code'] < $this->httpExceptionCodeLevel) {
return;
}
// Format message for better readability in NewRelic dashboard
$formattedMessage = sprintf('%s: %s in %s line %s', $this->getDisplayName($extra), $message, $file, $line);
if (isset($extra['exception'])) {
newrelic_notice_error($formattedMessage, $extra['exception']);
} else {
newrelic_notice_error($formattedMessage);
}
return !$this->getCallNextHandler();
}
开发者ID:kslimani,项目名称:cerberus,代码行数:18,代码来源:NewRelicHandler.php
示例18: indexAction
/**
* Instantiate IPN model and pass IPN request to it
*/
public function indexAction()
{
if (!$this->getRequest()->isPost()) {
return;
}
try {
$data = $this->getRequest()->getPost();
Mage::getModel('paypal/ipn')->processIpnRequest($data, new Varien_Http_Adapter_Curl());
} catch (Exception $e) {
if (function_exists('newrelic_notice_error')) {
/**
* Adds error to New Relic
* @link https://newrelic.com/docs/php/the-php-api#api-notice-error
*/
newrelic_notice_error($e->getMessage(), $e);
}
Mage::logException($e);
$this->getResponse()->setHttpResponseCode(500);
}
}
开发者ID:LybeAB,项目名称:Magento-Paypalfixes,代码行数:23,代码来源:IpnController.php
示例19: process
/**
* {@inheritdoc}
*/
public function process(Message $message, array $options)
{
if ($this->extensionLoaded) {
newrelic_start_transaction($options['new_relic_app_name'], $options['new_relic_license']);
newrelic_name_transaction($options['new_relic_transaction_name']);
newrelic_background_job(true);
}
try {
$result = $this->processor->process($message, $options);
} catch (\Exception $e) {
if ($this->extensionLoaded) {
newrelic_notice_error(null, $e);
newrelic_end_transaction();
}
throw $e;
}
if ($this->extensionLoaded) {
newrelic_end_transaction();
}
return $result;
}
开发者ID:behinddesign,项目名称:swarrot,代码行数:24,代码来源:NewRelicProcessor.php
示例20: write
/**
* {@inheritDoc}
*/
protected function write(array $record)
{
if (!$this->isNewRelicEnabled()) {
throw new ehough_epilog_handler_MissingExtensionException('The newrelic PHP extension is required to use the NewRelicHandler');
}
if ($appName = $this->getAppName($record['context'])) {
$this->setNewRelicAppName($appName);
}
if (isset($record['context']['exception']) && $record['context']['exception'] instanceof Exception) {
newrelic_notice_error($record['message'], $record['context']['exception']);
unset($record['context']['exception']);
} else {
newrelic_notice_error($record['message']);
}
foreach ($record['context'] as $key => $parameter) {
newrelic_add_custom_parameter($key, $parameter);
}
foreach ($record['extra'] as $key => $parameter) {
newrelic_add_custom_parameter($key, $parameter);
}
}
开发者ID:ehough,项目名称:epilog,代码行数:24,代码来源:NewRelicHandler.php
注:本文中的newrelic_notice_error函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论