| @@ 65-81 (lines=17) @@ | ||
| 62 | * @param Host $host |
|
| 63 | * @param string $line |
|
| 64 | */ |
|
| 65 | public function writeln(string $type, Host $host, string $line) |
|
| 66 | { |
|
| 67 | $line = self::filterOutput($line); |
|
| 68 | ||
| 69 | // Omit empty lines |
|
| 70 | if (empty($line)) { |
|
| 71 | return; |
|
| 72 | } |
|
| 73 | ||
| 74 | if ($type === Process::ERR) { |
|
| 75 | $line = "[{$host->getTag()}] <fg=red>err</> $line"; |
|
| 76 | } else { |
|
| 77 | $line = "[{$host->getTag()}] $line"; |
|
| 78 | } |
|
| 79 | ||
| 80 | $this->output->writeln($line); |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * This filtering used only in Ssh\Client, but for simplify putted here. |
|
| @@ 46-62 (lines=17) @@ | ||
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| 46 | public function writeln(Host $host, string $type, string $line) |
|
| 47 | { |
|
| 48 | $line = Printer::filterOutput($line); |
|
| 49 | ||
| 50 | // Omit empty lines |
|
| 51 | if (empty($line)) { |
|
| 52 | return; |
|
| 53 | } |
|
| 54 | ||
| 55 | if ($type === Process::ERR) { |
|
| 56 | $line = "[{$host->getAlias()}] err $line"; |
|
| 57 | } else { |
|
| 58 | $line = "[{$host->getAlias()}] $line"; |
|
| 59 | } |
|
| 60 | ||
| 61 | $this->log($line); |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||