diff --git a/CHANGELOG.md b/CHANGELOG.md index d0c9a9183..261fa2989 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # Release Notes -## [Unreleased](https://github.com/laravel/octane/compare/v1.0.5...1.x) +## [Unreleased](https://github.com/laravel/octane/compare/v1.0.6...1.x) + + +## [v1.0.6 (2021-06-22)](https://github.com/laravel/octane/compare/v1.0.5...v1.0.6) + +### Changed +- Set roadrunner `http.middleware` as an option ([#327](https://github.com/laravel/octane/pull/327)) + +### Fixed +- Prints server logs to "stderr" ([#326](https://github.com/laravel/octane/pull/326), [28cf5ee](https://github.com/laravel/octane/commit/28cf5ee6c98d6c4708179fbbba2f1c71125d4efa)) ## [v1.0.5 (2021-06-15)](https://github.com/laravel/octane/compare/v1.0.4...v1.0.5) diff --git a/src/Commands/Concerns/InteractsWithIO.php b/src/Commands/Concerns/InteractsWithIO.php index d8c0fb0ed..97011d65b 100644 --- a/src/Commands/Concerns/InteractsWithIO.php +++ b/src/Commands/Concerns/InteractsWithIO.php @@ -2,6 +2,7 @@ namespace Laravel\Octane\Commands\Concerns; +use Illuminate\Console\OutputStyle; use Illuminate\Support\Str; use Laravel\Octane\Exceptions\DdException; use Laravel\Octane\Exceptions\ServerShutdownException; @@ -19,11 +20,29 @@ trait InteractsWithIO * * @var array */ - protected $ignoreErrors = [ + protected $ignoreMessages = [ + 'scan command', 'stop signal received, grace timeout is: ', 'exit forced', + 'worker constructed', + 'worker destructed', ]; + /** + * Write a string as raw output. + * + * @param string $string + * @return void + */ + public function raw($string) + { + if (! Str::startsWith($string, $this->ignoreMessages)) { + $this->output instanceof OutputStyle + ? fwrite(STDERR, $string."\n") + : $this->output->writeln($string); + } + } + /** * Write a string as information output. * @@ -45,9 +64,7 @@ public function info($string, $verbosity = null) */ public function error($string, $verbosity = null) { - if (! Str::contains($string, $this->ignoreErrors)) { - $this->label($string, $verbosity, 'ERROR', 'red', 'white'); - } + $this->label($string, $verbosity, 'ERROR', 'red', 'white'); } /** @@ -74,7 +91,7 @@ public function warn($string, $verbosity = null) */ public function label($string, $verbosity, $level, $background, $foreground) { - if (! empty($string)) { + if (! empty($string) && ! Str::startsWith($string, $this->ignoreMessages)) { $this->output->writeln([ '', " $level $string", diff --git a/src/Commands/StartRoadRunnerCommand.php b/src/Commands/StartRoadRunnerCommand.php index b8b7e4dca..3685efb76 100644 --- a/src/Commands/StartRoadRunnerCommand.php +++ b/src/Commands/StartRoadRunnerCommand.php @@ -83,8 +83,8 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve '-o', 'rpc.listen=tcp://'.$this->option('host').':'.$this->rpcPort(), '-o', 'http.pool.supervisor.exec_ttl='.$this->maxExecutionTime(), '-o', 'http.static.dir=public', - '-o', 'http.middleware=static', - '-o', app()->environment('local') ? 'logs.mode=production' : 'logs.mode=none', + '-o', 'http.middleware='.config('octane.swoole.http_middleware', 'static'), + '-o', 'logs.mode=production', '-o', app()->environment('local') ? 'logs.level=debug' : 'logs.level=warning', '-o', 'logs.output=stdout', '-o', 'logs.encoding=json', @@ -172,6 +172,10 @@ protected function writeServerOutput($server) return $this->handleStream($stream); } + if ($debug['logger'] == 'server') { + return $this->raw($debug['msg']); + } + if ($debug['level'] == 'debug' && isset($debug['remote'])) { [$statusCode, $method, $url] = explode(' ', $debug['msg']); diff --git a/src/Commands/StartSwooleCommand.php b/src/Commands/StartSwooleCommand.php index 8a3be8953..a7cf5e7a4 100644 --- a/src/Commands/StartSwooleCommand.php +++ b/src/Commands/StartSwooleCommand.php @@ -179,20 +179,7 @@ protected function writeServerOutput($server) ->each(function ($group) { is_array($stream = json_decode($output = $group->first(), true)) && isset($stream['type']) ? $this->handleStream($stream) - : $this->error($output); - - if (($count = $group->count()) > 1) { - $this->newLine(); - - $count--; - - $this->line(sprintf(' ↑ %s %s', - $count, - $count > 1 - ? 'similar errors were reported.' - : 'similar error was reported.' - )); - } + : $this->raw($output); }); }