public static function getPluginNameFromBacktrace($backtrace) { foreach ($backtrace as $tracepoint) { // try and discern the plugin name if (isset($tracepoint['class'])) { $className = self::getPluginNameFromNamespace($tracepoint['class']); if ($className) { return $className; } } } return false; }
/** * Returns the name of the plugin/class that triggered the log. * * @return string */ private function getLoggingClassName() { $backtrace = $this->getBacktrace(); $name = Plugin::getPluginNameFromBacktrace($backtrace); // if we can't determine the plugin, use the name of the calling class if ($name == false) { $name = $this->getClassNameThatIsLogging($backtrace); } return $name; }