本文整理汇总了PHP中newrelic_notice_error函数的典型用法代码示例。如果您正苦于以下问题:PHP newrelic_notice_error函数的具体用法?PHP newrelic_notice_error怎么用?PHP newrelic_notice_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了newrelic_notice_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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);
}
示例4: onError
public function onError(Application $app, \Exception $e)
{
if ($e instanceof BadRequestException) {
return;
// ignore
}
newrelic_notice_error($e->getMessage(), $e);
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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']);
}
}
}
示例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);
}
}
示例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']);
}
}
示例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);
}
}