You are here

static function Exception::GetCaller in Realistic Dummy Content 8

Returns the calling function through a backtrace

Overrides Exception::GetCaller

2 calls to Exception::GetCaller()
Exception::GetCalled in api/src/loggers/Exception.php
Returns the called function through a backtrace
Exception::Log in api/src/loggers/Exception.php
1 method overrides Exception::GetCaller()
Exception::GetCaller in api/src/loggers/Exception.php
Returns the calling function through a backtrace

File

api/src/loggers/Exception.php, line 39
Define autoload class.

Class

Exception
An \Exception.

Namespace

Drupal\realistic_dummy_content_api\loggers

Code

static function GetCaller() {

  // a funciton x has called a function y which called this
  // see stackoverflow.com/questions/190421
  $caller = debug_backtrace();
  $caller = $caller[Exception::REALISTIC_DUMMY_CONTENT_BACKTRACE_LEVEL];
  $r = $caller['function'] . '()';
  if (isset($caller['class'])) {
    $r .= ' in ' . $caller['class'];
  }
  if (isset($caller['object'])) {
    $r .= ' (' . get_class($caller['object']) . ')';
  }
  return $r;
}