diff --git a/composer.json b/composer.json index 3c82b0d..1adcd5f 100644 --- a/composer.json +++ b/composer.json @@ -9,8 +9,7 @@ "require-dev": { "phpunit/phpunit": "^5.0 || ^6.0 || ^7.0", "ext-xdebug": "*", - "php": "~5.6 || ~7.0", - "monolog/monolog": "^1.23" + "php": "~5.6 || ~7.0" }, "autoload-dev": { "psr-4": { diff --git a/src/prepend.php b/src/prepend.php index ebd9540..34129f5 100644 --- a/src/prepend.php +++ b/src/prepend.php @@ -12,7 +12,26 @@ call_user_func(function() { $x = new \Composer\XdebugHandler\XdebugHandler('RWX'); if ($logFile = getenv('RWX_DEBUG_LOG')) { - $logger = new \Monolog\Logger('rwx', [new \Monolog\Handler\StreamHandler($logFile)]); + if (!class_exists(Logger::class, false)) { + class Logger extends \Psr\Log\AbstractLogger + { + private $filename; + public function __construct($filename) + { + $this->filename = $filename; + } + public function log($level, $message, array $context = array()) + { + $formatted = '[' . $level . '] ' + . $message + . " : " + . strtr(var_export($context, true), ["\r" => '', "\n" => '']) + . PHP_EOL; + file_put_contents($this->filename, $formatted, FILE_APPEND); + } + } + } + $logger = new Logger($logFile); } else { $logger = new \Psr\Log\NullLogger; }