diff --git a/composer.json b/composer.json index bfe206f..6a117fe 100644 --- a/composer.json +++ b/composer.json @@ -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", @@ -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": { diff --git a/src/Shell/CustomShell.php b/src/Shell/CustomShell.php index 397720b..0ecb12f 100644 --- a/src/Shell/CustomShell.php +++ b/src/Shell/CustomShell.php @@ -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(); diff --git a/src/Shell/ShellLogListener.php b/src/Shell/ShellLogListener.php index 14e5242..8f56ac5 100644 --- a/src/Shell/ShellLogListener.php +++ b/src/Shell/ShellLogListener.php @@ -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'); } }