Skip to content

Commit

Permalink
Add telescope getPath method (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
guandeng committed Dec 26, 2023
1 parent 8e890c5 commit 491f8b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Aspect/LogAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint)
$level = $level instanceof UnitEnum ? (int) $level->value : (int) $level; /* @phpstan-ignore-line */
$message = $proceedingJoinPoint->arguments['keys']['message'];
$context = $proceedingJoinPoint->arguments['keys']['context'];
if (Str::contains($message, 'telescope')) {
if (Str::contains($message, Telescope::getPath())) {
return;
}
$name = $proceedingJoinPoint->getInstance()->getName();
Expand Down
2 changes: 1 addition & 1 deletion src/Listener/DbQueryListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function process(object $event): void
$sql = Str::replaceFirst('?', "'{$value}'", $sql);
}
}
if (Str::contains($sql, 'telescope')) {
if (Str::contains($sql, Telescope::getPath())) {
return;
}
$optionSlow = Telescope::getQuerySlow();
Expand Down
5 changes: 5 additions & 0 deletions src/Telescope.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ public static function getQuerySlow(): int
return static::getConfig()->getDatabaseQuerySlow();
}

public static function getPath(): string
{
return static::getConfig()->getPath();
}

/**
* Add a callback that adds tags to the record.
*
Expand Down

0 comments on commit 491f8b4

Please sign in to comment.