Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@
"email": "taylor@laravel.com"
}
],
"repositories": [
{
"type": "vcs",
"url": "https://gitlab.covergenius.biz/cg/php/php-logger.git"
}
],
"require": {
"php": "^7.2.5|^8.0",
"php": "^8.0",
"illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
Expand All @@ -22,8 +28,12 @@
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^8.5.8|^9.3.3|^10.0"
},
"replace": {
"laravel/tinker": "^v2.10.0"
},
"suggest": {
"illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0)."
"illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0).",
"covergenius/php-logger": "^5.1.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/Shell/CustomShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CustomShell extends Shell
{
protected function getDefaultLoopListeners(): array
{
$listeners = parent::getDefaultLoopListeners(); // TODO: Change the autogenerated stub
$listeners = parent::getDefaultLoopListeners();

$listeners[] = new ShellLogListener();

Expand Down
15 changes: 10 additions & 5 deletions src/Shell/ShellLogListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,27 @@ class ShellLogListener extends AbstractListener
/**
* Listen for code execution.
*
* @param \Psy\Shell $shell
* @param string $code
* @param Shell $shell the shell instance
* @param string $code the code from psy that we want to log
* @return void
*/
public function onExecute(Shell $shell, $code)
public function onExecute(Shell $shell, string $code): void
{
\Log::debug('Tinker session code run', ['code' => $code]);
\Covergenius\Php\Logger\Resources\ArbitraryDataLogger::log([
'source' => 'tinker',
'code' => $code
]);
}

/**
* Determines if this log listener is supported.
*
* currently we check if php-logger class for arbitrary data logging exists
*
* @return bool
*/
public static function isSupported(): bool
{
return true; //implement a proper check
return class_exists('\Covergenius\Php\Logger\Resources\ArbitraryDataLogger');
}
}