outputs .= removeAnsiColors($output); } public function instantSave() { } public function getLogs($refresh = false) { if ($this->container) { if ($this->showTimeStamps) { $sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} -t {$this->container}"); } else { $sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} {$this->container}"); } if ($refresh) { $this->outputs = ''; } Process::run($sshCommand, function (string $type, string $output) { $this->doSomethingWithThisChunkOfOutput($output); }); if ($this->showTimeStamps) { $this->outputs = str($this->outputs)->split('/\n/')->sort(function ($a, $b) { $a = explode(' ', $a); $b = explode(' ', $b); return $a[0] <=> $b[0]; })->join("\n"); } } } public function render() { return view('livewire.project.shared.get-logs'); } }