Customize origin search #141
jozydapozy
started this conversation in
Ideas
Replies: 1 comment
-
I've managed to make this work by sending a custom Payload where I override the origin: class LogCustomOriginPayload extends LogPayload {
private Origin $_origin;
public static function createWithOrigin(?string $file, ?int $line, array $arguments): Payload {
$origin = new Origin($file, $line);
$payload = parent::createForArguments($arguments);
$payload->_origin = $origin;
return $payload;
}
protected function getOrigin(): Origin {
return $this->_origin;
}
} and then in the calling method: $frames = \Spatie\Backtrace\Backtrace::create()->frames();
$payLoad = LogCustomOriginPayload::createWithOrigin($frames[1]->file, $frames[1]->lineNumber, $params);
ray()->sendRequest($payLoad); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Since Ray is awesome, I want to call it from a already present debugging-function in my code.
Then, this function will print the debug-info to the screen or send the data to Ray.
pseudocode:
This works, except for the fact that Ray shows, ofcourse, the file and line-number of this above ray()-call.
It would be nice if you could configure the depth of the origin-search, so that Ray could show the line where my custom debugging-method was called.
Beta Was this translation helpful? Give feedback.
All reactions